SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Apr 2005
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help creating zip archives dynamically

    I'm trying to figure out how to create a zip file on the server; so far I've been trying to use a class I found at: http://www.planet-source-code.com/vb...d=957&lngWId=8

    I edited the example from the site above, but I'm not sure if I did it correctly...specifically, I didn't know what to do when it told me to: // add the binary data stored in the string 'filedata'

    Both the class and the example usage can be found at the site above, and my edited version of the example usage is below. Also, I'm using shared yahoo hosting, and yahoo's list of supported php functions is right here: http://help.yahoo.com/help/us/webhos...hp/php-33.html



    PHP Code:
    <?

    require("zipclass.php");

    $myFile "uploads/test.txt";
    $fh fopen($myFile,'r');
    $theData fread($fh20);


    $zipfile = new zipfile();  

    // add the subdirectory ... important!
    $zipfile -> add_dir("uploads/");

    // add the binary data stored in the string 'filedata'
    $filedata fread($myFile);  
    $zipfile -> add_file($filedata"uploads/test.text");  

    // the next three lines force an immediate download of the zip file:
    header("Content-type: application/octet-stream");  
    header("Content-disposition: attachment; filename=test.zip");  
    echo 
    $zipfile -> file();  

    echo 
    $theData;

    ?>
    I'd really appreciate any help with this...I've been trying to get it to work for the last two days

  2. #2
    SitePoint Zealot glowdot's Avatar
    Join Date
    Jun 2007
    Location
    Santa Monica, CA
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That link says they only support read for zip functions.
    Advertise on Glowfoto
    banners as low as $25/month, text ads $10/month
    Share 10 million impressions per month!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •