Hi,
Here's two different options this one uses the asp XStandard.zip component
Code:
<%
response.write "started ...<br>"
Dim objZip,curdir,zip,cmd,dir,fsp,objItem
curdir = server.mappath("/")
Set objZip = Server.CreateObject("XStandard.zip")
cmd = trim(lCase(Request.Form("cmd")))
if len(cmd) = 0 then
cmd = trim(lCase(Request.QueryString("cmd")))
if len(cmd) = 0 then cmd = "unzip"
end if
zip = trim(lCase(Request.Form("zip")))
if len(zip) = 0 then
zip = trim(lCase(Request.QueryString("zip")))
end if
dir = trim(lCase(Request.Form("dir")))
if len(dir) = 0 then
dir = trim(lCase(Request.QueryString("dir")))
end if
fsp = trim(lCase(Request.Form("fsp")))
if len(fsp) = 0 then
fsp = trim(lCase(Request.QueryString("fsp")))
end if
select case cmd
case "unzip"
if len(fsp) = 0 then
objZip.UnPack curdir & "\" & zip, curdir & "\" & dir
else
objZip.UnPack curdir & "\" & zip, curdir & "\" & dir, fsp
end if
case "zip"
if len(fsp) = 0 then
objZip.Pack curdir & "\" & dir, curdir & "\" & zip
else
objZip.Pack curdir & "\" & dir, curdir & "\" & zip, fsp
end if
case "list"
For Each objItem In objZip.Contents(curdir & "\" & zip)
Response.Write objItem.Path & objItem.Name & vbTab & objItem.size & "<br />"
Next
end select
response.write objZip.ErrorDescription
Set objZip = Nothing
response.write " ... done.<br>"
%>
basic command
Code:
domain.co.uk/webzip.asp?zip=[filename.zip]
domain.co.uk/webzip.asp?zip=[filename.zip]&cmd=list
unzip cmd is assumed if not supplied.
Note:this code is not bomb proof at all just allows me to zip/unziplist zips online, also note if the dir you are unziping to exists the XStandard.zip component wil erase the contents of the destination dir before unzipping. see here http://www.xstandard.com/en/documentation/xzip/ for more info.
The alternative, which I've not fully explored, is http://www.net2ftp.com/ which if locally installed you can use to install a large selection of packages without needing to download/upload them, the list of applications that can be installed can be extended easily. it may need tweaking on the installation routine as it assumes the domainname.com is the root and so puts wwwroot in the url to execute the installation routine, I've just not got there yet and my php isn't so great.
Regards
Keith
Bookmarks