Flare Hosting
Home Products and Services About Us Support Resellers Contact Us Site Map Call Toll-Free: 1-877-97-FLARE (35273)
Support - FAQ
ASP and .NET FAQ - ASP SmartUpload Sample ASP script

Important - When using this code, you must be sure to check the extention type that is being uploaded to the server. We do not allow scripts to be uploaded via asp upload pages. These include .php, .asp, .aspx, .cgi, .js, .vbs, .pl, .exe, or any other script file. Sites found allowing these upload types will be suspended until the proper checks are enabled.

Here is a FAQ for helping you with ASP SmartUPload on Flarehosting.com.
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>



See also:

  Domain Search
www.  
  Special Offer
 Free Domain Registration
more info 
 Customer Referral Program
more info 
30day money back guarantee
Microsoft Certified Partners
  Copyright © 1999-2008 Flare Hosting. All Rights Reserved.
  Terms and Conditions of Use  |  Domain Registration Agreement  |  ICANN Policy  |  Guarantees