RE: [PHP] Uploading images only

From: Date: Wed, 31 Jan 2001 01:43:09 +0000
Subject: RE: [PHP] Uploading images only
Groups: php.general 
Request: Send a blank email to php-general+get-37367@lists.php.net to get a copy of this message
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:brandon@webintellects.com] 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 brandon@webintellects.com 800-994-6364 www.webintellects.com -------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#37367) next »