%
'Stores only files with size less than MaxFileSize
Dim DestinationPath
'DestinationPath = Server.mapPath("images")
if session("Module") = "Downloads" then
DestinationPath = Server.mapPath (session("vdownloads"))
else
DestinationPath = Server.mapPath (session("vimagedir"))
end if
'Using Huge-ASP file upload
'Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")
'Using Pure-ASP file upload
Dim Form: Set Form = New ASPForm %><%
Server.ScriptTimeout = 2000
Form.SizeLimit = &HA00000
'{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}
%>
Power ASP file upload - simple upload with progress bar indicator.. |
---|
Form size limit is <%=Form.SizeLimit \ 1024 %>kB Destination folder is <%=DestinationPath%> |