Re: Different size of file on server and on output
| From: | Pavel Janda | Date: | Mon, 22 Oct 2007 12:43:28 +0000 |
| Subject: | Re: Different size of file on server and on output | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263491@lists.php.net to get a copy of this message | ||
Thanks a lot. However there wasn't any visible whitespace in code, leaving of ?> helped... I haven't known, that it is not required :o).
Thank you very much again!
Pavel
M. Sokolewicz napsal(a):
Pavel Janda wrote:Hello to everybody, I have this problem with downloading files via PHP. For illustration - I am using this fragment of code: <?phpProbably that whitespace after your last ?> What I would recommend is to just leave off the last ?>, it's not required and by not adding it you won't see those annoying problems with whitespaces causing corrupt data. - Tulheader("Content-type: $contenttype; name=\"$outputfilename\""); header("Content-disposition: form-data; filename=\"$outputfilename\"");$fp=fopen($filename,'r'); while (!FEof($fp)): $filedata.=fread($fp,8192); endwhile; fclose($fp); echo $filedata;?> The problem is, that the file on server has 16857 bytes and saved file has 16858. In another case downloaded file has everytime 1 byte more than the original file on server. When I put JPEG or ZIP forexample to output, there is no problem with opening file like this. Bud when I am trying .docx (Office2007 file format) it occures mistake during opening this file in MSOffice... Can anybody helps me with this problem? Why is the file size increasing one byte? Whitch byte it is? Thanks a lot! Pavel