Different size of file on server and on output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello to everybody,

I have this problem with downloading files via PHP. For illustration - I am using this fragment of code:

<?php

	header("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

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux