File (image) upload

From: Date: Wed, 26 Jun 2002 03:02:28 +0000
Subject: File (image) upload
Groups: php.general 
Request: Send a blank email to php-general+get-103894@lists.php.net to get a copy of this message
Hello again, still banging away at 4.2 upgrades :) This used to work in 4.1.2 ... ----------------- if (is_uploaded_file ($userfile)) { $memfile = fopen ($userfile, "r"); $image = fread ($memfile, filesize ($userfile)); $db_image = addslashes ($image); $db_image_name = addslashes ($userfile_name); $db_image_type = addslashes ($userfile_type); } else { whatever (); } do_some_db_storge (); ----------------- ... but this does not ... ----------------- if (is_uploaded_file ($_FILES["userfile"])) { $memfile = fopen ($_FILES["userfile"], "r"); $image = fread ($memfile, filesize ($_FILES["userfile"])); $db_image = addslashes ($image); $db_image_name = addslashes ($_FILES["userfile"]["name"]); $db_image_type = addslashes ($_FILES["userfile"]["type"]); } else { whatever (); } do_some_db_storge (); ----------------- I can get valid data from $_FILES["userfile"]["name"] and $_FILES["userfile"]["type"] (such as "pic1.gif" and "image/gif") but $_FILES["userfile"] does not contain the actual image data and just returns "array", so where is the actual binary image data that used to be if (is_uploaded_file ($userfile)) { } ? I think I'm missing something pretty elementary. I'm running PHP 4.2.1 on MacOSX/Apache 1.3.23 if that means anything in this case. Regards Zim

« previous php.general (#103894) next »