PHP4 Bug/Feature? File upload variables not set in HTTP_POST_VARS

From: Date: Wed, 22 Nov 2000 01:05:58 +0000
Subject: PHP4 Bug/Feature? File upload variables not set in HTTP_POST_VARS
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-4032@lists.php.net to get a copy of this message
Hi all, I'm running both PHP3.0.16 & PHP4.04dev on Win98 with Apache 1.3.12. I used to be able to access the file upload variables as part of the $HTTP_POST_VARS globals, but now my scripts are broken because this is no longer the case. PHP3.0.16 sets the file upload variables in $HTTP_POST_VARS - except for $HTTP_POST_VARS[$userfile."_type"], ie. one could previously under PHP3 access $HTTP_POST_VARS["MyFile_name"] and $HTTP_POST_VARS["MyFile_size"]. Is this a bug is PHP4, or a "feature"? Can we have these returned in HTTP_POST_VARS? Ignatius PS: Some code is attached below to demonstrate the problem. Notice what gets returned by $HTTP_POST_VARS running under both PHP3 and PHP4 ============================================================== <?php $upload_dir = "d:/Temp/"; //$enctype = "application/x-www-form-urlencoded"; $enctype = "multipart/form-data"; if ($REQUEST_METHOD=="POST") { print "\$HTTP_POST_VARS returned:<BR>"; if (is_array($HTTP_POST_VARS)) { while (list($key,$val) = each($HTTP_POST_VARS)) { print "[$key] = $val<br>\n"; } } else { print "$HTTP_POST_VARS<br>\n"; } print "Now the actual variables set are:<BR>"; print "MyFile = $MyFile<BR>"; print "MyFile_name = $MyFile_name<BR>"; print "MyFile_size = $MyFile_size<BR>"; print "MyFile_type = $MyFile_type<BR>"; $destFile = $upload_dir.basename($MyFile_name); echo "\$destFile=$destFile<BR>\n"; if (!copy($MyFile,$destFile)) { echo "Error uploading $MyFile to $destFile"; } else { echo "$MyFile uploaded to $destFile"; } } else { ?> <form enctype="<?php echo $enctype;?>" name="myform" action="<?php echo basename($PHP_SELF);?>" method="POST"> <table> <tr> <td>File to upload</td> <td><input name="MyFile" type="file"></td> </tr> <tr> <td colspan="2"> <!--input type="hidden" name="MAX_FILE_SIZE" value="50000"--> <input name="submit" value="submit" type="submit"> </td> </tr> </table> </form> <?php } ?>

« previous php.windows (#4032) next »