binary or readfile for pdf file in php

Written By | 22 October 2009| One Comment

If you are constantly annoyed about PDF files that were created by the allegedly defective PHP, stored on the server, however, are intact: readfile not appear converts blanks to null bytes in the data stream.

A parameter for a binary behavior is not clear from the current document only at times. Therefore, it is first time only in this way:

$ pdf = file_get_contents ($ tmppdf, FILE_BINARY);
echo $ pdf;

If the file is larger but can the $ pdf variable amount of memory needed. Then, unfortunately, has its own loop here:

tmppdf $ file = fopen ($, ‘rb’);
while (feof ($ file)) (
echo fread ($ file, 2048);
)
fclose ($ file);

Share With Others

Similar Articles

    None Found

One Comment »

  • Inside the Webb said:

    Learning PHP is something I can’t seem to ever master, i am always finding new bits of code to inspire me to learn more.

Leave your response!