Jump to content

Search the Community

Showing results for tags 'zip'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

Found 3 results

  1. Hello, I am creating zip file of multiple files using PHP and downloading it. Problem is that: zip file is getting extracted by only WinRAR, its not getti ng extracted by default windows extracter or other software. Here is code which I have written - $file_folder = 'referral-resume/'; if(extension_loaded('zip')) { if(isset($_POST['files']) and count($_POST['files']) > 0) { $zip = new ZipArchive(); $zip_name = "referralresumes".time().".zip"; if($zip->open($zip_name, ZIPARCHIVE::CREATE)!==TRUE) { $error .= "* Sorry ZIP creation failed at this time"; } foreach($_POST['files'] as $file){ $zip->addFromString(basename($file_folder.$file), file_get_contents($file_folder.$file)); } $zip->close(); if(file_exists($zip_name)){ header('Content-type: application/zip'); header('Content-Disposition: attachment; filename="'.$zip_name.'"'); readfile($zip_name); unlink($zip_name); } } else{ $error .= "* Please select file to zip "; } } else{ $error .= "* You dont have ZIP extension"; }
  2. Hi there! I was wondering if anyone here has experience in putting zip files on your websites, for others to download and use? I am setting up a website that is offering a bunch of pdf dokuments and mp3-files, set up as a local web-page in html. Meaning: "open zip file and click on index.html" - thus getting access to the downloaded local "website". But I am having trouble zipping the html-folder. Or rather: some of the PC/Windows users are having trouble unzipping the file. The file unzips and works well on my Mac, - and on my 2 test PC's (Vista and XP). But some users report errors when unzipping. ("Unexpected error." And "There is a problem with the encryption of the folder") .... I should mention that the users are mostly VERY unexperienced computer-people. So it needs to be as simple as possible and with as few choices and options as possible. The users are mostly blond sopranos, and the folder contains singing instructions and instructional mp3's. (Im kidding about the blond part) Does anyone have ideas to how I should compress the folder? Thanks John
  3. I am new to Drupal and am attempting to build a custom module to connect to ftp, download a zip file and unzip the file on the server. The zip file contains two product csv files to update price lists on an ecommerce site. I have gotten it worked out to connect, and download the file. But no matter what code I try I cannot seem to get the files extracted. I can get the code working within a separate php file for testing but once I put it in the php and run from the cron tab it refuses to unzip. I am at a loss as to what to try next. I would really appreciate any pointers I could get! These are some of the things I have tried... the closest I have gotten is to have the first csv file within to create and start but it never finishes and the second file never starts. After changing the code so many times I couldn't even begin to tell you what I had when it was able to get that far. $server_file = 'ItemExport.zip'; $shell = "unzip $server_file"; $shell = escapeshellcmd($shell); exec($shell); $zip = new ZipArchive(); if ($zip->open('ItemExport.zip') === TRUE) { for($i = 0; $i < ($zip->numFiles); $i++) { $filename = $zip->getNameIndex($i); $zip->extractTo('.', array(trim($filename))); } $zip->close(); } else { echo 'failed'; } $zip = zip_open("ItemExport.zip"); if ($zip) { while ($zip_entry = zip_read($zip)) { $fp = fopen(zip_entry_name($zip_entry), "w"); if (zip_entry_open($zip, $zip_entry, "r")) { $buf = zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); fwrite($fp,"$buf"); zip_entry_close($zip_entry); fclose($fp); } } zip_close($zip); } $zip_entry = 'ItemExport.zip'; $file_name = array('StandardExport.csv', 'AmazonExport.csv'); //get the file's size $fileSize = zip_entry_filesize($zip_entry); for($x = 0; $x<2;$x++) { //open the target file $outFile = fopen($file_name[$x],"wb"); while ($fileSize>0) { //read/write only up to 10kb per step $readSize = min($fileSize,10240); //decrease the size of the remaining data to read $fileSize -= $readSize; //get the data $content = zip_entry_read($zip_entry, $readSize); //write the data (if any) if ($content !== false) fwrite($outFile,$content); } fclose($outFile); }
  • 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.