Welcome Guest, Not a member yet? Register   Sign In
Zip class fails to download a file if the file is around 400Kb or more
#1

[eluser]Unknown[/eluser]
/*
Could anybody give me some advice, I've encountered that CI Zip class fails to download a file if the file is around 400Kb or more, for smaller files it works perfectly, to isolate the problem I've put the code that fails on a simplistic script. To run this code, copy Zip.php and this script to your htdocs folder and run it from there.
*/


<?php

require 'Zip.php';

$zip = new CI_Zip();

$path = 'C:/Temp/Jpg/BigFile.jpg'; // Points to the file we want to zip.

$zip->read_file($path , TRUE );

//
// This always work.
//
$zip->archive( 'C:/Temp/my_backup.zip' );

//
// This fails if the file is around 400Kb or more.
//
$zip->download('my_backup.zip');

?>
#2

[eluser]Jupiter[/eluser]
You might take a look at your PHP memory limit as zipping takes place in RAM and not on disk. However, if you plan to zip really big files, this is not the best solution.

Does anybody know how to generate and send a zip stream?

---
Peter




Theme © iAndrew 2016 - Forum software by © MyBB