NameSpace doesn't like zip file in ASP I have a vbscript that creates an empty zip file and then loads a couple of files into it for eventual download. As a stand-alone vbscript it works fine but when I add the code to an ASP page the code chokes on the NameSpace object. So I can create the empty zip file but I can't add any files to it.
Here's the code:
Dim zipFile, objFSO, objTxt, objApp
zipFile = "D:\ArcIMS\Output\SavedMapImages\aaa.zip" 'The path and name of your zip file
'Create an empty ZIP file
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objTxt = objFSO.OpenTextFile(zipFile, 2, True)
objTxt.Write Chr(80) & Chr(75) & Chr(5) & Chr(6) & String(18, Chr(0))
objTxt.Close
'Copy the files into the ZIP file
Set objApp = Server.CreateObject("Shell.Application")
objApp.NameSpace(zipFile).CopyHere("D:\ArcIMS\Output\SavedMapImages\aaa.png ")
objApp.NameSpace(zipFile).CopyHere("D:\ArcIMS\Output\SavedMapImages\aaa.pgw ")
It's the NameSpace object in the last two lines that throw errors. And it's the zip file itself that causes the error; I don't get an error if I use a basic folder path.
Does anybody have a solution?
Thanks,
Aaron |