<%@ Language=VBScript %> <% option explicit Response.Expires = -1 Server.ScriptTimeout = 600 %> <% ' **************************************************** ' Change the value of the variable below to the pathname ' of a directory with write permissions, for example "C:\Inetpub\wwwroot" Dim uploadsDirVar, tipo, strTitulo tipo = request.QueryString("t") if tipo = "video" then 'uploadsDirVar = "c:\web\irupiesgovbr\www\caparaocapixaba\images\autores" uploadsDirVar = strCaminhoFisico & "imagens\capas\agenda" strTitulo = "Enviar imagem" elseif tipo = "img" then uploadsDirVar = strCaminhoFisico & "imagens\capas\agenda" strTitulo = "Enviar imagem capa" end if ' **************************************************** ' Note: this file uploadTester.asp is just an example to demonstrate ' the capabilities of the freeASPUpload.asp class. There are no plans ' to add any new features to uploadTester.asp itself. Feel free to add ' your own code. If you are building a content management system, you ' may also want to consider this script: http://www.webfilebrowser.com/ function OutputForm() %>
Arquivo:  
<% end function function TestEnvironment() Dim fso, fileName, testFile, streamTest TestEnvironment = "" Set fso = Server.CreateObject("Scripting.FileSystemObject") if not fso.FolderExists(uploadsDirVar) then '
O alor uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions. TestEnvironment = "A pasta " & uploadsDirVar & " não existe." exit function end if fileName = uploadsDirVar & "\test.txt" on error resume next Set testFile = fso.CreateTextFile(fileName, true) If Err.Number<>0 then '
The value of your uploadsDirVar is incorrect. Open uploadTester.asp in an editor and change the value of uploadsDirVar to the pathname of a directory with write permissions. TestEnvironment = "A pasta " & uploadsDirVar & " não tem permissão de escrita." exit function end if Err.Clear testFile.Close fso.DeleteFile(fileName) If Err.Number<>0 then '
Change the permissions for IUSR_computername on this folder. TestEnvironment = "A pasta " & uploadsDirVar & " não permite exclusão, portanto não tem permissão de escrita." exit function end if Err.Clear Set streamTest = Server.CreateObject("ADODB.Stream") If Err.Number<>0 then '
Check the Requirements page for information about upgrading your ADODB libraries. TestEnvironment = "O objeto ADODB Stream não está válido no servidor." exit function end if Set streamTest = Nothing end function function SaveFiles Dim Upload, fileName, fileSize, ks, i, fileKey Dim fs_x_DownloadArquivo, EW_Max_File_Size Set Upload = New FreeASPUpload Upload.Save(uploadsDirVar) ' If something fails inside the script, but the exception is handled If Err.Number<>0 then Exit function SaveFiles = "" 'usado para delimitar EW_Max_File_Size = Upload.Form("EW_Max_File_Size") ks = Upload.UploadedFiles.keys if (UBound(ks) <> -1) then SaveFiles = "
Arquivo enviado: " for each fileKey in Upload.UploadedFiles.keys fs_x_DownloadArquivo = Upload.UploadedFiles(fileKey).Length ' Check the file size If fs_x_DownloadArquivo > 0 And CLng(EW_Max_File_Size) > 0 Then If fs_x_DownloadArquivo > CLng(EW_Max_File_Size) Then Response.Write Replace("Tamanho Maximo do arquivo (%s bytes) excedido.", "%s", EW_Max_File_Size) 'Response.End else SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & " bytes) " End If End If 'SaveFiles = SaveFiles & Upload.UploadedFiles(fileKey).FileName & " (" & Upload.UploadedFiles(fileKey).Length & " bytes) " %> <% response.write "" next else SaveFiles = "O nome do arquivo a enviar nao corresponde a um nome valido no sistema de origem." end if end function %> <%=strTitulo%>
<%=strTitulo%>
Selecione o arquivo que deseja enviar e clique em 'Enviar Arquivo'.
Tamanho Máximo: 2MB.
<% Dim diagnostics if Request.ServerVariables("REQUEST_METHOD") <> "POST" then diagnostics = TestEnvironment() if diagnostics<>"" then response.write "
" response.write diagnostics response.write "

Depois de corrigir o problema, atualize a página." response.write "

" else OutputForm() end if else OutputForm() response.write SaveFiles() response.write "

" end if %>