How to use ASP & aspSmartUpload - Get file properties This is learn/tutorial asp developers how to using ASP script upload file by aspSmartUpload and get file properties.
ShotDev Focus:
- ASP & Upload file by aspSmartUpload and get file properties.
Example
asp_upload3.asp
<% OptionĀ Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form action="asp_upload4.asp" method="post" enctype="multipart/form-data" name="frmMain"> Upload 1 <input name="file1" type="file"><br> Upload 2 <input name="file2" type="file"> <input type="submit" name="Submit" value="Submit"> </form> </body> </html>
asp_upload4.asp
<% OptionĀ Explicit %> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Dim mySmartUpload '*** Create Object ***' Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload") '*** Upload Files ***' mySmartUpload.Upload '*** Upload file1 ***' If mySmartUpload.Files("file1").FileName <> "" Then mySmartUpload.Files("file1").SaveAs(Server.MapPath("MyFiles/" & mySmartUpload.Files("file1").FileName)) Response.write mySmartUpload.Files("file1").Name & " Uploaded." End If '*** Upload file2 ***' If mySmartUpload.Files("file2").FileName <> "" Then mySmartUpload.Files("file2").SaveAs(Server.MapPath("MyFiles/" & mySmartUpload.Files("file2").FileName)) Response.write mySmartUpload.Files("file2").Name & " Uploaded." End IF '*** Properties ***' 'Response.Write("Name = " & mySmartUpload.Files("file1").Name & "<BR>") 'Response.Write("Size = " & mySmartUpload.Files("file1").Size & "<BR>") 'Response.Write("FileName = " & mySmartUpload.Files("file1").FileName & "<BR>") 'Response.Write("FileExt = " & mySmartUpload.Files("file1").FileExt & "<BR>") 'Response.Write("FilePathName = " & mySmartUpload.Files("file1").FilePathName & "<BR>") 'Response.Write("ContentType = " & mySmartUpload.Files("file1").ContentType & "<BR>") 'Response.Write("ContentDisp = " & mySmartUpload.Files("file1").ContentDisp & "<BR>") 'Response.Write("TypeMIME = " & mySmartUpload.Files("file1").TypeMIME & "<BR>") 'Response.Write("SubTypeMIME = " & mySmartUpload.Files("file1").SubTypeMIME & "<BR>") Set mySmartUpload = Nothing %> </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_upload3.asp
Screenshot
3immobility…
…