HTTP_POST_VARS not a multi-dimensional array?

From: Date: Sun, 17 Dec 2000 18:28:51 +0000
Subject: HTTP_POST_VARS not a multi-dimensional array?
Groups: php.general 
Request: Send a blank email to php-general+get-30749@lists.php.net to get a copy of this message
Hi, I'm new to PHP, so forgive me if I'm making a really stupid mistake here. I'd like to post a file through a form: <form method=post action=bm_upload_2.php> <INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="10240"> <input type=file name=userfile><br> <input type=submit> </form> when i run this code, which i picked up off php.net: <? echo "Values submitted via POST method:<br>"; reset ($HTTP_POST_VARS); while (list ($key, $val) = each ($HTTP_POST_VARS)) { echo "$key => $val<br>"; } ?> i get the following result: Values submitted via POST method: MAX_FILE_SIZE => 10240 userfile => A:\\talk.txt Now, the php manual concerning post file uploads makes it clear that HTTP_POST_VARS['userfile'] should be an array, but when I try to get the type or size via $HTTP_POST_FILES['userfile']['type'], etc., I only get the first letter of userfile - which in this case is 'A'. So, it seems to me that unless I'm missing some basic element of PHP syntax, HTTP_POST_FILES['userfile'] is just a string, not an associative array. Am I doing something wrong here? Another thing: I'm using the following code to move the file to my /tmp directory: <? if (move_uploaded_file($userfile, "/tmp/")) { print("move succeeded"); } else { print("move failed"); } ?> and it continually prints "move failed". I imagine that this is related to the post_vars problems, but maybe there's another problem in there... My setup is: Apache 1.3.14, PHP 4.0.3pl1, mod_ssl 2.7.1 (I'm testing this over SSL) Thanks so much, Haig Didizian hcd@seas.upenn.edu

« previous php.general (#30749) next »