RE: [PHP-DB] Restricting mime type in file uploads?
| From: | Russ | Date: | Thu, 08 Aug 2002 03:08:00 +0000 |
| Subject: | RE: [PHP-DB] Restricting mime type in file uploads? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21055@lists.php.net to get a copy of this message | ||
Dave:
Using the field name for the 'file' HTML input type, PHP allows you to
add an underscore to the end of that fieldname to access the file type
and size:
For example:
<input type='file' name'userfile' />
Once submitted in a form:
$userfile: This is obviousely the uploaded file's name.
$userfile_type: this is the MIME type for this uploaded file.
$userfile_size: this is the filesize in bytes (check manual) of the
uploaded file
Check out:
http://www.isi.edu/in-notes/iana/assignments/media-types/media-types
for further info on MIME and MEDIA Types
HTH :-)
Russ
-----Original Message-----
From: Dave Carrera [mailto:dave@davecarrera.com]
Sent: Wednesday, August 07, 2002 3:20 PM
To: php-db@lists.php.net
Subject: [PHP-DB] Restricting mime type in file uploads?
Hi All
I have a working ap to allow clients to upload their images to a server
& then I write the path to a MySql db for retrieval later.
But I have been asked if we can control the mime type to only accept
JPG's and nothing else.
I can't seem to find the answer anywhere so I humbly ask for your help
or guidance.
Thank you in advance
Dave C