Creating ZIP file from classic ASP

Discussion in 'General Web Coding' started by Sailor, Feb 22, 2009.

  1. Sailor

    Sailor Perch

    I have a need to create a zip file of images on the server. The list of images changes frequently and it's difficult to keep the zip file up to date. I'd like to create a script so that whenever the images change we could run this script to delete the old zip and create a new one with the most recent images.
    I've seen several references to using WScript.Shell to do this. Is this something that is available on Jodo servers, and would it have the appropriate permissions?

    If not (and it does sound like a security problem) are there any other ways to achieve this?

  2. Stephen

    Stephen US Operations Staff Member

  3. Sailor

    Sailor Perch

    Thanks Stephen - looks like it will do what I need. Will try it out.
  4. Sailor

    Sailor Perch

    That XZip component worked perfectly - does exactly what I need it to do and my client is very happy.

  5. zaboss

    zaboss Perch

    i'm trying to use that component, but it's not working, without throwing an error. It simply doesn't creates a zip file.

    Here it is the code
    Dim objZip
    Set objZip = Server.CreateObject("XStandard.Zip")
    objZip.Pack "d://hshome/myaccount/folder/file.mdb", "d://hshome/myaccount/folder/formulare"&date()&".zip"
    Set objZip = Nothing
    Response.redirect "formulare"&date()&".zip"
    Hm, sorted. I was tryng to zip a file that was placed ouside the site folder and it's not working. But in the site folder it works.
  6. Stephen

    Stephen US Operations Staff Member

    That is by design, the way the security model works :)
  7. zaboss

    zaboss Perch

    I knew the files outside the site folder are not accesible from outside (that's why I keep my databases in a folder placed at the site folders level), but I thought they are available for scripts as dbs are.
  8. Sailor

    Sailor Perch

    I haven't run that code, but at a guess I'd say the filename you end up with from this would be an illegal filename, because it's likely to contain / or other illegal characters. You might want to first get the date, replace all non-alpha characters, then use it in the file name.


  9. albertam

    albertam Guppy

    That XZip component worked perfectly . Yes I also use it for my work .Its working really fantastic.
  10. vikramverma

    vikramverma Guppy

    thanks for sharing the information

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services