[PHP] Brainfart while uploading

2002-09-09 Thread César Aracena

Hi all.
 
I just saw my code laugh at me when this exploded into my face. Can
anyone tell me why isn’t this working? I just copied it from another
page made by me for the same site, changed the parameters and tested it,
but it doesn’t work here… how’s 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 successfullybr;
$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 there’s no [tmp_name] anywhere… how’s 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:[EMAIL PROTECTED] Cesar Aracena
On Dial-Up
CE / MCSE+I
Neuquen, Argentina
+54.299.6356688
+54.299.4466621
 



RE: [PHP] Brainfart while uploading -- SOLVED -- Sorry ;)

2002-09-09 Thread César Aracena

The only brain cells I've got awake at this moment figure out that when
copying an upload form/code the enctype must be copied as well...
sorry for this. I had some more trouble, but it was solved by giving the
appropriate permissions to the folder.

Thanks again, C.

 -Original Message-
 From: César Aracena [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, September 10, 2002 1:04 AM
 To: PHP General List
 Subject: [PHP] Brainfart while uploading
 
 Hi all.
 
 I just saw my code laugh at me when this exploded into my face. Can
 anyone tell me why isn’t this working? I just copied it from another
 page made by me for the same site, changed the parameters and tested
it,
 but it doesn’t work here… how’s 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 successfullybr;
 $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 there’s no [tmp_name] anywhere… how’s 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:[EMAIL PROTECTED] Cesar Aracena
 On Dial-Up
 CE / MCSE+I
 Neuquen, Argentina
 +54.299.6356688
 +54.299.4466621
 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php