hafa
Perch
I've been trying to get a pdf upload capability through http working for one site I'm designing. I've tried aspupload and aspsmartupload, and both have issues with files larger than 500k or so. aspsmartupload returns a browser error "document contains no data" while aspUpload returns a script timeout error. I've set Server.ScriptTimeout = 60, but it still times out.
Please note that both scripts work OK for files < 500km but the client would like to be able to use an online utility to upload pdfs of around 3-8mb; any help getting this going would be appreciated. I've put my code below:
ASPUPLOAD:
<%
Server.ScriptTimeout = 60
Set Upload = Server.CreateObject("Persits.Upload")
' we use memory uploads, so we must limit file size
Upload.SetMaxSize 10000000, True
' Save to memory. Path parameter is omitted
Upload.Save
' Access subdirectory specified by user
subdir = Upload.Form("\docs")
' Build path string
Path = Server.MapPath("\docs")
' Create path, ignore "already exists" error
Upload.CreateDirectory Path, True
' Save files to it. Our form has only one file item
' but this code is generic.
For Each File in Upload.Files
File.SaveAs Server.MapPath("\docs\" & Request.QueryString("docID") & ".pdf")
Response.Write "File saved as " & File.Path & "<BR>"
Next
%>
SMART ASPUPLOAD:
<%
' Variables
' *********
Dim mySmartUpload
Dim file
Dim intCount
intCount=0
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Upload
' ******
mySmartUpload.Upload
' Select each file
' ****************
For each file In mySmartUpload.Files
' Only if the file exist
' **********************
If not file.IsMissing Then
' Save the files with his original names in a virtual path of the web server
' **************************************************************************
file.SaveAs(Server.MapPath("\docs\" & Request.QueryString("docID") & ".pdf")
' sample with a physical path
' file.SaveAs("c:\temp\" & file.FileName)
' Display the properties of the current file
' ******************************************
Response.Write("Name = " & file.Name & "<BR>")
Response.Write("Size = " & file.Size & "<BR>")
Response.Write("FileName = " & file.FileName & "<BR>")
Response.Write("FileExt = " & file.FileExt & "<BR>")
Response.Write("FilePathName = " & file.FilePathName & "<BR>")
Response.Write("ContentType = " & file.ContentType & "<BR>")
Response.Write("ContentDisp = " & file.ContentDisp & "<BR>")
Response.Write("TypeMIME = " & file.TypeMIME & "<BR>")
Response.Write("SubTypeMIME = " & file.SubTypeMIME & "<BR>")
intCount = intCount + 1
End If
Next
' Display the number of files which could be uploaded
' ***************************************************
Response.Write("<BR>" & mySmartUpload.Files.Count & " files could be uploaded.<BR>")
' Display the number of files uploaded
' ************************************
Response.Write(intCount & " file(s) uploaded.<BR>")
%>
Please note that both scripts work OK for files < 500km but the client would like to be able to use an online utility to upload pdfs of around 3-8mb; any help getting this going would be appreciated. I've put my code below:
ASPUPLOAD:
<%
Server.ScriptTimeout = 60
Set Upload = Server.CreateObject("Persits.Upload")
' we use memory uploads, so we must limit file size
Upload.SetMaxSize 10000000, True
' Save to memory. Path parameter is omitted
Upload.Save
' Access subdirectory specified by user
subdir = Upload.Form("\docs")
' Build path string
Path = Server.MapPath("\docs")
' Create path, ignore "already exists" error
Upload.CreateDirectory Path, True
' Save files to it. Our form has only one file item
' but this code is generic.
For Each File in Upload.Files
File.SaveAs Server.MapPath("\docs\" & Request.QueryString("docID") & ".pdf")
Response.Write "File saved as " & File.Path & "<BR>"
Next
%>
SMART ASPUPLOAD:
<%
' Variables
' *********
Dim mySmartUpload
Dim file
Dim intCount
intCount=0
' Object creation
' ***************
Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
' Upload
' ******
mySmartUpload.Upload
' Select each file
' ****************
For each file In mySmartUpload.Files
' Only if the file exist
' **********************
If not file.IsMissing Then
' Save the files with his original names in a virtual path of the web server
' **************************************************************************
file.SaveAs(Server.MapPath("\docs\" & Request.QueryString("docID") & ".pdf")
' sample with a physical path
' file.SaveAs("c:\temp\" & file.FileName)
' Display the properties of the current file
' ******************************************
Response.Write("Name = " & file.Name & "<BR>")
Response.Write("Size = " & file.Size & "<BR>")
Response.Write("FileName = " & file.FileName & "<BR>")
Response.Write("FileExt = " & file.FileExt & "<BR>")
Response.Write("FilePathName = " & file.FilePathName & "<BR>")
Response.Write("ContentType = " & file.ContentType & "<BR>")
Response.Write("ContentDisp = " & file.ContentDisp & "<BR>")
Response.Write("TypeMIME = " & file.TypeMIME & "<BR>")
Response.Write("SubTypeMIME = " & file.SubTypeMIME & "<BR>")
intCount = intCount + 1
End If
Next
' Display the number of files which could be uploaded
' ***************************************************
Response.Write("<BR>" & mySmartUpload.Files.Count & " files could be uploaded.<BR>")
' Display the number of files uploaded
' ************************************
Response.Write(intCount & " file(s) uploaded.<BR>")
%>