<%@ Language=VBScript %> <% %><% option explicit Response.Expires = -1 Server.ScriptTimeout = 28800 'Stores only files with size less than MaxFileSize Dim DestinationPath DestinationPath = Server.mapPath("upload") Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm") Server.ScriptTimeout = 200000 Form.SizeLimit = &H10000000 '{b}Set the upload ID for this form. 'Progress bar window will receive the same ID. if len(Request.QueryString("UploadID"))>0 then Form.UploadID = Request.QueryString("UploadID")'{/b} end if 'was the Form successfully received? Const fsCompletted = 0 If Form.State = fsCompletted Then 'Completted 'was the Form successfully received? if Form.State = 0 then 'Do something with upload - save, enumerate, ... response.write "
Upload result: Form was accepted." response.write "
Number of file fields:" & Form.Files.Count response.write "
Request total bytes:" & Request.TotalBytes Form.Files.Save DestinationPath response.write "
Files was saved to " & DestinationPath & " folder." End If ElseIf Form.State > 10 then Const fsSizeLimit = &HD Select case Form.State case fsSizeLimit: response.write "
Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)
" case else response.write "
Some form error.
" end Select End If'Form.State = 0 then '{b}get an unique upload ID for this upload script and progress bar. Dim UploadID, PostURL UploadID = Form.NewUploadID 'Send this ID as a UploadID QueryString parameter to this script. PostURL = Request.ServerVariables("SCRIPT_NAME") & "?UploadID=" & UploadID'{/b} %> <% ' **************************************************** ' Change the value of the variable below to the pathname ' of a directory with write permissions, for example "C:\Inetpub\wwwroot" Dim uploadsDirVar uploadsDirVar = "c:\inetpub\www.pcedesign.com\upload" ' **************************************************** ' 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() %>
File 1:
File 2:
File 3:

<% end function function TestEnvironment() Dim fso, fileName, testFile, streamTest TestEnvironment = "" Set fso = Server.CreateObject("Scripting.FileSystemObject") if not fso.FolderExists(uploadsDirVar) then TestEnvironment = "Folder " & uploadsDirVar & " does not exist.
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." exit function end if fileName = uploadsDirVar & "\test.txt" on error resume next Set testFile = fso.CreateTextFile(fileName, true) If Err.Number<>0 then TestEnvironment = "Folder " & uploadsDirVar & " does not have write permissions.
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." exit function end if Err.Clear testFile.Close fso.DeleteFile(fileName) If Err.Number<>0 then TestEnvironment = "Folder " & uploadsDirVar & " does not have delete permissions, although it does have write permissions.
Change the permissions for IUSR_computername on this folder." exit function end if Err.Clear Set streamTest = Server.CreateObject("ADODB.Stream") If Err.Number<>0 then TestEnvironment = "The ADODB object Stream is not available in your server.
Check the Requirements page for information about upgrading your ADODB libraries." exit function end if Set streamTest = Nothing end function %> PCE - Downloads











Please Submit or View Files below:
<% Dim diagnostics if Request.ServerVariables("REQUEST_METHOD") <> "POST" then diagnostics = TestEnvironment() if diagnostics<>"" then response.write "
" response.write diagnostics response.write "

After you correct this problem, reload the page." response.write "

" else response.write "
" OutputForm() response.write "Note: Large Files may take extended periods of time to upload.

" end if else response.write "
" OutputForm() response.write "
Note: Large Files may take extended periods of time to upload.

" end if %>

Please select from the following list of files to download

<% dim fileSystem, topFolder, subFiles, subFile, Length, moviename set fileSystem = server.createObject("Scripting.FileSystemObject") set topFolder = fileSystem.getFolder("c:\inetpub\www.pcedesign.com\upload") set subFiles = topFolder.files for each subFile in subFiles length = Len(subFile.name) moviename = left( subFile.name, (length-4) ) response.write ("") response.write ("") next %>
") response.write ("") response.write ("") response.write ( subFile.name ) response.write ("" & round((subFile.size/(1024*1024)),2) & " MB

 

Company Profile | Capabilities | Experience | Key Personnel | Partial Client List | Downloads
Contact Us | Partners | Links | Positions Available | Home

© 2000 Power Consulting Engineers