Bug #14390: HTTP Upload files missing few bytes from end
| From: | dannytuppeny at ntlworld dot com | Date: | Sun, 09 Dec 2001 12:08:33 +0000 |
| Subject: | Bug #14390: HTTP Upload files missing few bytes from end | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-73098@lists.php.net to get a copy of this message | ||
From: dannytuppeny@ntlworld.com
Operating system: WinXP
PHP version: 4.1.0
PHP Bug Type: Filesystem function related
Bug description: HTTP Upload files missing few bytes from end
I have some scripts used to upload gifs. The form has the right enctype,
and the script looks like:
==
list($filename, $fileext) = explode(".", basename($upfile_name));
$file = $filename . '.' . $fileext;
if (file_exists($DOCUMENT_ROOT . '/dbimages/' . $file)) {
$i = 0;
while(file_exists($DOCUMENT_ROOT . '/dbimages/' . $file)) {
$i++;
$file = $filename . '(' . $i . ').' . $fileext;
}
}
$rfp = fopen($upfile, 'r');
$wfp = fopen($DOCUMENT_ROOT . '/dbimages/' . $file, 'w');
fwrite($wfp, fread($rfp, filesize($upfile)));
fclose($wfp);
fclose($rfp);
==
But the uploaded file is missing a few bytes. Check out the screenshot
below. It's only about 5 bytes missing, but that doesn't help a browser
trying to render the image.
I downloaded a windows binary about 2 weeks ago and installed it on
winxp/apache. If you need any other info, just ask.
http://customfones.com/temp/php_upload.GIF
--
Edit bug report at: http://bugs.php.net/?id=14390&edit=1