|
ASP Smart Upload
Go Back
Here is a FAQ for helping you with ASP SmartUPload on
itsgroup.org.
Files must be uploaded in the Upload folder : it's the only
directory which have the correct rights.
There are 3 files:
File 1, Select.htm : Source file selection
<HTML>
<BODY BGCOLOR="white">
<FORM METHOD="POST" ACTION="upload.asp" ENCTYPE="multipart/form-data">
<INPUT TYPE="FILE" NAME="FILE1" SIZE="50"><br>
<INPUT TYPE="SUBMIT" VALUE="Upload">
</FORM>
</BODY>
</HTML>
File 2, Upload.asp : call of the ASPSmartUpload component
<%
'Uncomment ONLY after debugging is complete
'on error resume next
Dim mySmartUpload 'declare the component
Dim intCount ' counter for the number of uploaded files
Dim File 'declare the file to upload
Dim filename 'Temp filename
Dim nextPage 'Next Page to forward to
intCount=0 'initialize the counter
'component creation
Set mySmartUpload=
Server.CreateObject("aspSmartUpload.SmartUpload")
'limit the file size to 50 Kb, Larger size not recommended
mySmartUpload.MaxFileSize = 50000
' limit the file extensions to pictures files
mySmartUpload.allowedFilesList="gif,jpg"
'Select files on the user computer
mySmartUpload.Upload
' checking all the files
For each file in mySmartUpload.Files
If not File.IsMissing then
' Add a session number to the file name
filename="../upload/" &session.sessionID & "_" & file.FileName
file.SaveAs(filename)
intCount = intCount + 1
End If
Next
' initialize the object
Set mySmartUpload=nothing
' error managment
If Err.Number = 0 then
nextPage = "asplook.asp?file=" & filename & ""
Else
nextPage = "asplook.asp?msg=An error as occured. Try again"
End if
' redirect to the result display
Response.redirect nextPage
%>
File 3, Asplook.asp : display results
<HTML>
<BODY BGCOLOR="white">
<%
if IsEmpty(request.querystring("msg")) then
%>
<img src="<%=request.querystring("file")%>">
<%
else
%>
<%=request.querystring("msg")%>
<%
end if
%>
</BODY>
</HTML>
Go Back
If
you have any questions:
support@ITsGroup.org or Phone 1-780-669-1548. |