ID: 14390 Updated by: sander Reported By: [EMAIL PROTECTED] Old Status: Open Status: Bogus Bug Type: Filesystem function related Operating System: WinXP PHP Version: 4.1.0 New Comment:
On Windows, you should use 'b' while opening binary files. $wfp = fopen($DOCUMENT_ROOT . '/dbimages/' . $file, 'wb'); Previous Comments: ------------------------------------------------------------------------ [2001-12-09 07:08:32] [EMAIL PROTECTED] 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 this bug report at http://bugs.php.net/?id=14390&edit=1 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]