coolphpdude Posted August 4, 2008 Share Posted August 4, 2008 upload picture script problem. uploads jpg (lowercase) but not JPG (uppercase). Why?? im having a problem with my script and i have only just figured out what is causing it but i don't know what to do to fix it! Any files that have got uppercase file extensions are getting rejected on upload as invalid file type, any ideas why??? i will post my code that i think it is in connection with. //SWITCHES THE IMAGE CREATE FUNCTION BASED ON FILE EXTENSION switch($image_type) { case '.jpg': $img_src = imagecreatefromjpeg($sourcefile); break; case '.jpeg': $img_src = imagecreatefromjpeg($sourcefile); break; case '.png': $img_src = imagecreatefrompng($sourcefile); break; case '.gif': $img_src = imagecreatefromgif($sourcefile); break; default: echo("Error Invalid Image Type"); die; break; } if ((($_FILES["pic"]["type"] == "image/pjpeg") || ($_FILES["pic"]["type"] == "image/jpeg") || ($_FILES["pic"]["type"] == "image/JPEG") || ($_FILES["pic"]["type"] == "image/png") || ($_FILES["pic"]["type"] == "image/bmp")) && ($_FILES["pic"]["size"] < 4000000)) any idea??? Link to comment https://forums.phpfreaks.com/topic/118106-solved-upload-picture-script-problem-uploads-jpg-lowercase-but-not-jpg-uppercase/ Share on other sites More sharing options...
The Little Guy Posted August 4, 2008 Share Posted August 4, 2008 do this: $tem_it = strtolower($image_type); switch($tem_it) { case '.jpg': $img_src = imagecreatefromjpeg($sourcefile); break; case '.jpeg': $img_src = imagecreatefromjpeg($sourcefile); break; case '.png': $img_src = imagecreatefrompng($sourcefile); break; case '.gif': $img_src = imagecreatefromgif($sourcefile); break; default: echo("Error Invalid Image Type"); die; break; } Link to comment https://forums.phpfreaks.com/topic/118106-solved-upload-picture-script-problem-uploads-jpg-lowercase-but-not-jpg-uppercase/#findComment-607630 Share on other sites More sharing options...
coolphpdude Posted August 4, 2008 Author Share Posted August 4, 2008 hey, thanks for your reply. Tried that, didn't work. Any other ideas? Link to comment https://forums.phpfreaks.com/topic/118106-solved-upload-picture-script-problem-uploads-jpg-lowercase-but-not-jpg-uppercase/#findComment-607648 Share on other sites More sharing options...
coolphpdude Posted August 4, 2008 Author Share Posted August 4, 2008 There must be someone out there that has working upload scripts on their sites that will have encountered this problem!?!? Link to comment https://forums.phpfreaks.com/topic/118106-solved-upload-picture-script-problem-uploads-jpg-lowercase-but-not-jpg-uppercase/#findComment-607658 Share on other sites More sharing options...
dezkit Posted August 4, 2008 Share Posted August 4, 2008 thats weird try this Link to comment https://forums.phpfreaks.com/topic/118106-solved-upload-picture-script-problem-uploads-jpg-lowercase-but-not-jpg-uppercase/#findComment-607664 Share on other sites More sharing options...
coolphpdude Posted August 4, 2008 Author Share Posted August 4, 2008 yeah tell me about it, at first I thought it was the original file size or original picture resolution but after playing about with it on photoshop i realised that it was the extension that was causing the problem. Both exactly the same file type just one uppercase and one lowercase, tested this thoroughly and for some reason it just refuses to upload uppercase file extensions. Link to comment https://forums.phpfreaks.com/topic/118106-solved-upload-picture-script-problem-uploads-jpg-lowercase-but-not-jpg-uppercase/#findComment-607675 Share on other sites More sharing options...
coolphpdude Posted August 4, 2008 Author Share Posted August 4, 2008 lol, i've asked much harder questions than this Link to comment https://forums.phpfreaks.com/topic/118106-solved-upload-picture-script-problem-uploads-jpg-lowercase-but-not-jpg-uppercase/#findComment-607697 Share on other sites More sharing options...
coolphpdude Posted August 4, 2008 Author Share Posted August 4, 2008 bump Link to comment https://forums.phpfreaks.com/topic/118106-solved-upload-picture-script-problem-uploads-jpg-lowercase-but-not-jpg-uppercase/#findComment-607733 Share on other sites More sharing options...
coolphpdude Posted August 4, 2008 Author Share Posted August 4, 2008 does any1 know how i cud convert all file extensions to lowercase then? or add uppercase extensions to that allow list? Link to comment https://forums.phpfreaks.com/topic/118106-solved-upload-picture-script-problem-uploads-jpg-lowercase-but-not-jpg-uppercase/#findComment-607771 Share on other sites More sharing options...
coolphpdude Posted August 5, 2008 Author Share Posted August 5, 2008 Bump!!! Link to comment https://forums.phpfreaks.com/topic/118106-solved-upload-picture-script-problem-uploads-jpg-lowercase-but-not-jpg-uppercase/#findComment-608427 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.