Re: Upload file - $HTTP_POST_FILES empty (thinking in harakiri)
| From: | Juan Pablo Aqueveque | Date: | Fri, 23 Aug 2002 15:16:47 +0000 |
| Subject: | Re: Upload file - $HTTP_POST_FILES empty (thinking in harakiri) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113857@lists.php.net to get a copy of this message | ||
Hi Daniel, Bas and Robert.
I tried all your suggestions, but STILL the array $_FILES (or $HTTP_POST_FILES) are COMPLETELY empty!.
(harakiri, here i go:-( )
:-(
--jp
At 16:21 23-08-2002 -0400, Robert James Kaes wrote:
On Fri, 23 Aug 2002, Juan Pablo Aqueveque wrote: <?php // In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of $_FILES. if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {________________________________________________________ Juan Pablo Aqueveque <juque@uct.cl> Ingeniero de Sistemas Departamento de Redes y Comunicaciones http://www.drc.uct.cl Universidad Católica de Temuco. Tel:(5645) 205 630 Fax:(5645) 205 628copy($_FILES['userfile']['tmp_name'],"/home/juque/public_html/VI_eaf/upload/"); } else {echo "Possible file upload attack. Filename: " .$_FILES['userfile']['name']; } /* ...or... */ move_uploaded_file($_FILES['userfile']['tmp_name'], "/home/juque/public_html/VI_eaf/upload/"); ?> I can't be certain, but one bug I think I see is the second argument to both copy() and move_uploaded_file() is not a complete path to a file. You provided the path, but not the file name the uploaded file should be saved as. So, I would change the code to be something like: if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {copy($_FILES['userfile']['tmp_name']), "/home/juque/public_html/VI_eaf/upload/" . $_FILES['userfile']['name']);} else {echo "Possible file upload attack.";} I hope this helps.-- Robert-- ------------------------------------------------------------------Robert James Kaes --- Flarenet Inc. --- (519) 426-3782 http://www.flarenet.com/ * Putting the Service Back in Internet Service Provider *------------------------------------------------------------------ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php