web 2.0

How to use ASP & Upload and Zip file

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

ASP & Upload and zip file.

ASP & Upload and zip file.

ASP & Upload and zip file.

ASP & Upload and zip file.

.
.
.
Download this script.
Download

1 Star2 Stars3 Stars4 Stars5 Stars6 Stars7 Stars8 Stars9 Stars10 Stars (1 votes, average: 1.00 out of 10)
Loading ... Loading ...

One Response to “How to use ASP & Upload and Zip file”

  1. 3sinning…

Leave a Reply

You must be logged in to post a comment.