CodeIgniter Forums
Problem Zip. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Problem Zip. (/showthread.php?tid=24375)



Problem Zip. - El Forum - 11-08-2009

[eluser]Browser[/eluser]
Hello all, i have the new code:

function comprimir($nombre) {
$this->load->library('zip');
$this->zip->read_file('http://localhost/searchmedic2/uploads/'.$nombre,TRUE);
$this->zip->download('my_backup.zip');
}

But, it don`t compile the file, why ?

Thanks you.


Problem Zip. - El Forum - 11-08-2009

[eluser]Ben Edmunds[/eluser]
Hey,

You'd probably be better off putting this under the Code and Application forum.

You need to supply a the full folder path to read_file. So on windows it'd be something like c:\wamp\www\searchmedic2\uploads\ or on linux something like /var/www/searchmedic2/uploads/.


Problem Zip. - El Forum - 11-08-2009

[eluser]jlew[/eluser]
I would guess that the read_file expects a file path not a url. Your read_file should be something like ./uploads/$nombre (or wherever the uploads directory is in relation to your index.php)


Problem Zip. - El Forum - 11-08-2009

[eluser]Ben Edmunds[/eluser]
Beat ya to it jlew Wink


Problem Zip. - El Forum - 11-08-2009

[eluser]jlew[/eluser]
[quote author="Ben Edmunds" date="1257760646"]Beat ya to it jlew Wink[/quote]
Yep, I noticed, by seconds!


Problem Zip. - El Forum - 11-09-2009

[eluser]Browser[/eluser]
But, i want to do a file with several files:

$this->zip->read_file('./uploads/'.$nombre,TRUE);
$this->zip->read_file('./uploads/curriculum1.zip',TRUE);

This, only put a one file en the file.zip. why?


Problem Zip. - El Forum - 11-09-2009

[eluser]Ben Edmunds[/eluser]
That should work fine.

Are you sure curriculum1.zip exists at that location?