SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: PHP .zip class

  1. #1
    SitePoint Zealot
    Join Date
    Jun 2007
    Location
    Regina, SK, Canada
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP .zip class

    I have the script working perfectly when I manually put files on the server to download into a zip (where the path is myfile.txt). The problem I face is when im trying to generate a file from the download.php file that its packing. If you follow.

    download.php?week=2007-03-04 generates an excel (csv) document. I want the zip script to pack the csv document. Instead it packs the download.php file itself. Is there a way I can open the file temporarily so it turns it into an excel document THEN puts it in the zip pack.

    Code PHP:
    $sel = mysql_query("SELECT DISTINCT week FROM schedules");
    	while($data = mysql_fetch_assoc($sel)){
    		$z -> addFile("download.php?week=".$data['week']."");
    	}
    $z -> zipFile("all_schedules.zip");

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $z -> addFile('http://yourdomain.tld/path/to/download.php?week=' $data['week']); 
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.


  3. #3
    SitePoint Zealot
    Join Date
    Jun 2007
    Location
    Regina, SK, Canada
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    "File not found" Darn..


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
  •