Page 1 of 1
[SOLVED] mime types on some images
Posted: Wed Nov 10, 2004 12:49 pm
by josh
Code: Select all
<?php
if(mime_content_type($_FILES['userfile']['tmp_name'])==NULL) {
find_out_whats_wrong
} else {
upload_it
}
?>
so... whats wrong? It works on most images except every once in a while I'll find an image it wont work on. If I try to upload it when it is == NULL, it puts a file there that matches the size of the uploaded file but its just a "corrupt pic"
Posted: Wed Nov 10, 2004 3:46 pm
by kettle_drum
Maybe try your luck using a different method to find out what file type it is:
or
Posted: Wed Nov 10, 2004 5:24 pm
by josh
$_FILES['userfile']['type'];
that returns null
I dont really care about image size right now.. even if I ignore the mime type and upload it regardless the picture will be "corrupt" but i can view it perfectly from my pc.. ive tried openin the image in photoshop and converting to gif/jpg/png etc... all do the same thing...
Posted: Thu Nov 11, 2004 2:53 am
by phpScott
[php_man]getimagesize[/php_man]() returns the mimetype of the image as well as the image size and an nice formatted height, width size for your img tag.
what is the mime type that you are expecting from this corrupt images?
Are they fancy, use special coding techniques or too big?
Posted: Thu Nov 11, 2004 12:04 pm
by josh
Ohh man i feel soooo stupid
Code: Select all
<input type="hidden" name="MAX_FILE_SIZE" value="30000000000000000000" />
I didn't know that you had to edit the MAX_FILE_SIZE ... i thought i just ran an if statement on the size after it's been uploaded, seems your browser will not send the image if you specify a max_file_size on the form you are sending it from and that exceeds.. in my script I said upload it no matter what file size so that threw me off
I noticed there was an ['error'] field in my array when I decided to print_r($_FILES); and looked it up here:
http://us2.php.net/manual/en/features.f ... errors.php