You can check the mime type of the uploaded file.

First upload the file, as usual.  Then check the mime type before copying
from the temp directory to the files directory.

If this is your form:
<form action="flm_upload.html" method="post" enctype="multipart/form-data">
<input type=hidden name=MAX_FILE_SIZE value=<?=$max_file_size?>>
File: <br>
<input type=file name=userfile></td>    
<input type=submit value="Upload File">
</form>

Then on submission, $userfile will be your file, $userfile_name will
automatically be the original file name, and $userfile_type will be the mime
type.  Check if image/gif or image/jpg (double check these) are in the mime
type, and copy($userfile, $file_directory.$userfile_name) for images only.
http://php.net/manual/en/features.file-upload.php


-Ben

-----Original Message-----
From: Brandon Orther [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, January 30, 2001 8:30 AM
To: PHP User Group
Subject: [PHP] Uploading images only


Hello,

Is there a way to only let images get upload while doing a simple file
upload form?

Thank you,

--------------------------------------------
Brandon Orther
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com
--------------------------------------------


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to