note 10602 added to Handling file uploads
| From: | dwight at wwwalker dot com dot au | Date: | Fri, 12 Jan 2001 02:39:43 +0000 |
| Subject: | note 10602 added to Handling file uploads | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-9686@lists.php.net to get a copy of this message | ||
I gave up trying to get PHP to work and used cgi-lib.pl and fup.pl. PHP kept trying to create
directories. cgi-lib.berkeley.edu is the source of cgi-lib.pl.
problem php script:
<?php
if (is_uploaded_file($userfile)) {
copy($userfile, "/home/swap/swap4free-www/images");
} else {
echo "Possible file upload attack: filename '$userfile'.";
}
/* ...or... */
move_uploaded_file($userfile, "/home/swap/swap4free-www/images");
?>
errors:
copy($userfile, "/images");
-> unable to create '/images' permission denied
move_uploaded_file($userfile, "/images");
-> unable to move '/tmp/phpFvqEp3' to '/images'
http://www.php.net/manual/features.file-upload.php