Jump to content

zip file for download


jpratt

Recommended Posts

I have the following code:

 

$source = '/vservers/essmedcom/htdocs/downloader/software/' . $i;
$target = '/vservers/essmedcom/htdocs/downloader/download/archive' . $i . '.zip';
$command = "/usr/bin/zip -r '$target' '$source'";

 

my problem is it zips the files i want to have at the root of the archive zip folder deep in the folders. I want to have it zip up files located at the software folder and place them at the root of the archive folder it creates. I tried this but didnt work to eliminate some of the folders deep:

 

$source = '/vservers/essmedcom/htdocs/downloader/software/' . $i;
$target = '/downloader/download/archive' . $i . '.zip';
$command = "/usr/bin/zip -r '$target' '$source'";

 

Any ideas? Thanks.

Link to comment
https://forums.phpfreaks.com/topic/114194-zip-file-for-download/
Share on other sites

first of all...for creating ZIPs, check out the PHP module: http://us3.php.net/zip, it's pretty slick.

 

as for the zip command, try the -j switch (more switches here: http://amath.colorado.edu/computing/software/man/zip.html)

$source = '/vservers/essmedcom/htdocs/downloader/software/' . $i;
$target = '/vservers/essmedcom/htdocs/downloader/download/archive' . $i . '.zip';
$command = "/usr/bin/zip -rj '$target' '$source'";

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.