<html> <head> <title>ThaiCreate.Com ASP Zip</title> </head> <body> <form action="AspUploadZipFiles.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>
<%Option Explicit%> <html> <head> <title>ThaiCreate.Com ASP Zip</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 %> </table> </body> </html>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท