Brainfart while uploading
| From: | César Aracena | Date: | Tue, 10 Sep 2002 04:04:19 +0000 |
| Subject: | Brainfart while uploading | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-115808@lists.php.net to get a copy of this message | ||
Hi all.
I just saw my code laugh at me when this exploded into my face. Can
anyone tell me why isnt this working? I just copied it from another
page made by me for the same site, changed the parameters and tested it,
but it doesnt work here
hows this possible?
****************BEGIN CODE*******************
if (is_uploaded_file($_FILES['revpic']['tmp_name'])){
copy($_FILES['revpic']['tmp_name'],
"/usr/local/www/virtual1/66/175/7/45/html/revpics");
echo "Review's picture uploaded successfully<br>";
$query = "INSERT INTO saav_reviews VALUES (NULL, '$revdate', '$revname',
'$revrev', ".$_FILES['revpic']['tmp_name'].")";
$result = mysql_query($query) or die (mysql_error());
if (!$result){
//Do Things
}
else if ($result){
//Do Things
}
}
else if (!is_uploaded_file($_FILES['revpic']['tmp_name'])){
$query = "INSERT INTO saav_reviews VALUES (NULL, '$revdate', '$revname',
'$revrev', NULL)";
$result = mysql_query($query) or die (mysql_error());
if (!$result){
//Do Things
}
else if ($result){
//Do Things
}
}
****************END CODE*******************
What bothers me, is that I pointed this file to my phpinfo.php and got
an empty array, so theres no [tmp_name] anywhere
hows that possible?
And the obvious result, is that the code pass right through to the else
if (!is_uploaded_file
instead of stopping at the if decision, and
stores everything but the uploaded image ¿anyone?
Thanks in advance,
<mailto:webmaster@icaam.com.ar> Cesar Aracena
On Dial-Up
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621