Jay Blanchard wrote:
I am following Coggeshall's article on Zend for creating ZIP files. I
seem to have run into a problem with PDF's though.

In his code you have to read the file into a variable. I have tried
file_get_contents, readfile, a combination of fopen, fpassthru, etc....

$filedata = readfile(INVOICEDIR."AOM.1075.542.54243641075B05130.pdf");

The next line in this little jewel runs the data through the ZIP
routines,

$zipfile->add_file($filedata,
"tempzip/AOM.1075.542.54243641075B05130.pdf");
I stayed up too late last night and got up too early this morning, so I
am just brain-farting on what I should do here. How do I get (or can I
get) the PDF data into the variable so that it comes out smelling like a
rose on the other end of the train where the ZIP file get opened and the
individual files are exapndable?

BTW, I have tested this with text too. I am having some problems there
as well, because file_get_contents seems to leave things 'short'.
However, if I fopen the text file and read the text into a variable I
can do the output side.

I appreciate any and all insight into this problem, even Nichel's :)


Did you try using fopen's binary safe read?  Something like :

$binary_data = "";
$fp = fopen ( $file, "rb" );
while ( ! feof ( $fp ) ) {
        $binary_data .= fgets ( $fp );
}
fclose ( $fp );

Don't know if it will work (or if you already tried it)...more like a guess.

PS don't trust that Nichel guy, he's really a HTML monkey using Front Page.

--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to