How to use ASP & Upload and Zip file This is tutorial asp developers how to using ASP upload and zip file.
ShotDev Focus:
- ASP & Upload and zip file.
Example
asp_upload_zip1.asp
<%Option Explicit%> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <form action="asp_upload_zip2.asp" method="post" enctype="multipart/form-data" name="frmMain"> Upload <input name="file1" type="file"> <input type="submit" name="Submit" value="Submit"> </form> </body> </html>
asp_upload_zip2.asp
<%Option Explicit%> <html> <head> <title>ShotDev.Com Tutorial</title> </head> <body> <% Dim sFileName Dim mySmartUpload '*** Upload By aspSmartUpload ***' '*** Create Object ***' Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload") '*** Upload Files ***' mySmartUpload.Upload '** Getfile Name ***' sFileName = mySmartUpload.Files("file1").FileName If sFileName <> "" Then '*** Upload **' mySmartUpload.Files("file1").SaveAs(Server.MapPath("MyXls/"&sFileName)) Dim objZip,sResult Set objZip = Server.CreateObject("Pnvzip.ZipFunctions") sResult = objZip.ZipFile(Server.MapPath("MyXls/"&sFileName),Server.MapPath("MyXls/MyZip.zip")) Response.Write "Result code :" & sResult & "<br>" Response.Write "<a href=MyXls/MyCustomer.zip>Click here</a> Download Zip Files " Set objZip = Nothing End IF %> </body> </html>
Create a asp file and save to path root-path/myasp/
Run
http://localhost/myasp/asp_extract_zip.asp
Screenshot
3sinning…
…