|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-03-25 01:02 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 09:00:01 2025 UTC |
Description: ------------ In release 5.0 this was noted: Changed HTTP file uploads not to throw E_WARNINGs and E_NOTICEs. The error value in the $_FILES global should be used for error handling. (Derick) However in version 5.0.3 on Linux the (it worked on windows) generates the following error on optional file upload fields that are not used: Notice: No file uploaded in Unknown on line 0 Using php5.0.3/Apache/2.0.46 (Red Hat). Reproduce code: --------------- <?php if(isset($_POST['submit'])){ var_dump($_FILES); print "<BR><BR>"; } ?> <form name="myForm" enctype="multipart/form-data" action="<?php echo $_SERVER['PHP_SELF'] ; ?>" method="post"> <table> <tr><td bgcolor="ffffff"><strong>Attachments:</strong></td></tr> <tr><td bgcolor="ffffff"><input type="file" name="file2[]" id="file1" class="button" size="30"></td></tr> <tr><td bgcolor="ffffff"><input type="file" name="file2[]" id="file1" class="button" size="30"></td></tr> <tr><td bgcolor="ffffff"><input type="file" name="file2[]" id="file1" class="button" size="30"></td></tr> <tr><td bgcolor="ffffff"><input type="submit" name="submit"></td></tr> </table> </form> Expected result: ---------------- a var_dump of the $_FILES data struture Actual result: -------------- <br /> <b>Notice</b>: No file uploaded in <b>Unknown</b> on line <b>0</b><br /> </font><br /> <b>Notice</b>: No file uploaded in <b>Unknown</b> on line <b>0</b><br /> </font>array(1) { ["file2"]=> array(5) { ["name"]=> array(3) { [0]=> string(9) "email.xls" [1]=> string(0) "" [2]=> string(0) "" } ["type"]=> array(3) { [0]=> string(24) "application/vnd.ms-excel" [1]=> string(0) "" [2]=> string(0) "" } ["tmp_name"]=> array(3) { [0]=> string(14) "/tmp/phpidlG5j" [1]=> string(0) "" [2]=> string(0) "" } ["error"]=> array(3) { [0]=> int(0) [1]=> int(4) [2]=> int(4) } ["size"]=> array(3) { [0]=> int(13824) [1]=> int(0) [2]=> int(0) } } }