Re: Error in php doc?
| From: | Roman Neuhauser | Date: | Sun, 03 Dec 2006 13:21:05 +0000 |
| Subject: | Re: Error in php doc? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-245463@lists.php.net to get a copy of this message | ||
# ms98j@hotmail.com / 2006-12-03 18:39:41 +0800:
> Hi. There seems to be a minor error in the page
> http://www.php.net/manual/en/features.file-upload.php. In
> Example 38-2
> "Validating file uploads", there is a line:
>
> $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
>
> It looks like basename() is not required there. Because i found that when i
> upload a file using IE6 (IE6 includes the whole path to the uploaded file,
> see
>
> http://jakarta.apache.org/commons/fileupload/faq.html#whole-path-from-IE),
>
> the value of $_FILES['userfile']['name'] is a file name but not a path. It
> looks like php has taken the file name from the path automatically. (I am
> using php 5.2.0 and win2k.) Can someone check if i am correct? Thanks.
That basename() call costs virtually nothing and protects you
against a bug in PHP and whatnot. Leave it there.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991