|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-01-30 10:47 UTC] johnson at nicusa dot com
I have seen in various places, postings that an uploaded file with size of 0 bytes should now fail. In version 4.2.2 on Solaris 8 it succeeds. Please make clear in the documentation exactly when/in which version of PHP this was changed to throw an error code 5. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 16:00:02 2025 UTC |
Actually it looks more than a documentation problem: For now there is not any define(name) for the new error code. Plus it looks it's under a #ifdef that can't happen because of : #undef DEBUG_FILE_UPLOAD in line 39 of main/rfc1867.c. There is the code: #ifdef DEBUG_FILE_UPLOAD if(strlen(filename) > 0 && total_bytes == 0) { sapi_module.sapi_error(E_WARNING, "Uploaded file size 0 - file [%s=%s] not saved", param, filename); cancel_upload = 5; } #endif You can note that usually #ifdef DEBUG_FILE_UPLOAD is used only to hide the sapi_module.sapi_error() function not the whole code. eg: if(strlen(filename) == 0) { #ifdef DEBUG_FILE_UPLOAD sapi_module.sapi_error(E_NOTICE, "No file uploaded"); #endif cancel_upload = UPLOAD_ERROR_D; } There is also an another point, why a file with 0 byte has to be cancelled? Has it been discussed? According to melvyn: why would php stop me to upload a file of 0 bytes? Take a 'web-ftp' for like a sitebuilder kinda app it would just upload these and create a 0 byte file, which is what I expect it to do for instance: config.php in phpBB2 is 0 bytes outof the box. it needs that to be, for install to work. So now there are some questions, does the code 5 ever happen? If yes is it expected that it stops the upload and why do not give it a real name so we can finally document it.