Re: More File Uploading Problems
| From: | Peter James | Date: | Sat, 20 Jul 2002 05:51:39 +0000 |
| Subject: | Re: More File Uploading Problems | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-108621@lists.php.net to get a copy of this message | ||
> <?php
> // In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of
> $_FILES.
> if (is_uploaded_file($HTTP_POST_FILES['fileUpload']['tmp_name'])) {
> copy($HTTP_POST_FILES['fileUpload']['tmp_name'],
> "http://www.mydomain.com/~demodocs/ProjDocs/");
> } else {
> echo "Possible file upload attack. Filename: " .
> $HTTP_POST_FILES['fileUpload']['name'];
> }
[snip]
> Warning: Unable to create 'BI-š‘¢6
"´Œ4
> í‚http://www.mydomain.com/~demodocs/ProjDocs/':
No
> such file or directory in /home/sites/home/users/demo/web/storefile.php
> on line 15
[snip]
> Does anyone have any thoughts as to why this is happening. Any help is
> appreciated.
You cannot copy to a url... use the path (relative or absolute) to this
location.
For instance, change to something like:
copy($HTTP_POST_FILES['fileUpload']['tmp_name'],
"/usr/local/www/..../ProjDocs");
Hope this helps.
P.