File Upload Name Mangling Question
| From: | Peter Vertes | Date: | Tue, 13 Jan 2004 00:25:14 +0000 |
| Subject: | File Upload Name Mangling Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-174391@lists.php.net to get a copy of this message | ||
I'm trying to upload a JPEG image into a database using PHP and I was
successful with the upload. However today I wanted to add a check to
make sure the user can only upload JPEG files and not any other files so
I use preg_match() to check for the strings ".jpg" or ".jpeg" in the
filename and after I've inserted this check into my code all my attempts
to upload files started to fail. I was mulling over the code and I
decided to print out the name of the uploaded file and to my suprise the
name was mangled. Instead of it being "picture.jpg" it was
"/tmp/progtemp/php/uploads/phpeZQiXd". Can anyone shed some light as to
how I could check to make sure that only JPEG images get uploaded ?
Thanks in advance...
-Pete
--
perl -e 'print pack("H*", "70766572746573406E79632E72722E636F6D0A")'
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc