Welcome Guest, Not a member yet? Register   Sign In
CI Zip Encoding Library Help
#1

[eluser]underparnv[/eluser]
I'm just going to dive right here. Here is my code:

Code:
<?php
$this->load->library("zip");
$file_location = "http://www.example.com/pdfs/file_name.pdf";
$file_name = basename($file_location);
$file_data = file_get_contents("./pdfs/" . $file_name);
$file_id = 1;
$name = "/" . $file_id . "/Sample.pdf";

$this->zip->add_data($name, $file_data);

$this->zip->archive('./pdfs/to_board/' . $hearing_date . '.zip');
?>

The above produces a file that is 20,258kb in size but has no data whatsoever in it.

When I add simply the directory manually I do get the folders, but no files within the folders. Why? Am I doing something wrong?

Thanks in advance,

underparnv
#2

[eluser]underparnv[/eluser]
Weirdest thing ever just happened...

I just tried to unzip the file using 7-Zip and it worked...and it had all the files in there! Weird!!
#3

[eluser]Michael Wales[/eluser]
Were you using 7zip the first time? How long after the file "appeared" in your filesystem were you waiting before trying to unzip it?

It may be taking your computer an abnormally long amount of time to actually build the Zip file - so when you were first trying the file was only partially built. This isn't necessarily an issue with the framework, just an issue of not being on a server with resources dedicated to this task (like your production server will be).
#4

[eluser]underparnv[/eluser]
I waited several minutes after double clicking the zip file. I'm assuming it's an issue with Windows XP's built in zip stuff...I guess Smile

Either way, I'm fine with the results Big Grin

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB