|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-10-11 04:14 UTC] marcot@php.net
[2005-10-12 05:41 UTC] jshay at dakotacom dot net
[2005-10-12 09:55 UTC] tony2001@php.net
[2005-10-14 07:16 UTC] jshay at dakotacom dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 30 09:00:02 2025 UTC |
Description: ------------ A simple upload script uploads the file, fully intact, but then a few seconds later zero's out the file making a zero byte length file. Reproduce code: --------------- <? $size = exec("ls -l $upload_item"); if ($upload_item) { print("<br />uploading to section = $section\n"); print("<br />file name = $upload_item_name\n"); print("<br />file size = $upload_item_size bytes\n"); print("<br />file in tmp = $size\n"); if (copy ($upload_item, "./$upload_item_name")) { print("<html><body>\n"); print("<p><b>your file was successfully uploaded!</b></p>\n"); print("<p>\n"); print("please note your file name - <b>$upload_item_name</b>\n"); print("<br />you will need to enter it in the appropriate form.\n"); print("</p>\n"); print("</body></html>"); } else { print("can't be copied - there may be another file with this name\n"); } } ?> Expected result: ---------------- The file should get written to the directory specified from the form and named the same name as the uploaded file. Actual result: -------------- Appropriate directories are writable by the apache user/group. Not a quota issue. 'upload_max_filesize' is set to 55 megs. No error log is generated as PHP has, as far as it thinks, written the file. What happens is the file gets uploaded to /tmp (full permisssions on /tmp) and then copied to the requested directory. I can grab a directory listing and see it in the specified directory in whole - original size and name. If I refresh the page again the file is zero'd out but with the original filename. I'm hesitant to call this a bug but having bounced this off other contacts in the industry I am left with no choice.