oceans Posted May 22, 2007 Share Posted May 22, 2007 Dear People, I have made a file uploader, I also made a filter, I can't make a good filter for jpeg files, but i can filter gif, can you advice, thanks if ($_FILES["file".]["type"] == "image/gif") bla bla bla Quote Link to comment https://forums.phpfreaks.com/topic/52454-image-file-upload-filtering/ Share on other sites More sharing options...
ToonMariner Posted May 22, 2007 Share Posted May 22, 2007 switch($_FILES["file"]["type"]) { case 'image/gif': // gif stuff. break; case 'image/jpg': case 'image/jpeg': // jpg stuff': break; case 'image/png': // png stuff. break; case 'application/pdf': // pdf stuff. break; } and so on...... Quote Link to comment https://forums.phpfreaks.com/topic/52454-image-file-upload-filtering/#findComment-258818 Share on other sites More sharing options...
oceans Posted May 22, 2007 Author Share Posted May 22, 2007 Sorry, What is the diff jpg & jpeg? I was told to use "pjpeg" Quote Link to comment https://forums.phpfreaks.com/topic/52454-image-file-upload-filtering/#findComment-258824 Share on other sites More sharing options...
kathas Posted May 22, 2007 Share Posted May 22, 2007 No difference in the file those are mime headers so you will no what kind of file this is... Quote Link to comment https://forums.phpfreaks.com/topic/52454-image-file-upload-filtering/#findComment-258827 Share on other sites More sharing options...
oceans Posted May 22, 2007 Author Share Posted May 22, 2007 Friends, I mislead again, What I ment was, are there two types of jpag files? Which is more common? Adding to that will my server get infected with virus, if the uploaded image files are infected, I think it will not, as I simply store it that is all. client loads, and the image is hyper linked and shown on my website that is all. What you think? Am I making sense? Quote Link to comment https://forums.phpfreaks.com/topic/52454-image-file-upload-filtering/#findComment-258834 Share on other sites More sharing options...
kathas Posted May 22, 2007 Share Posted May 22, 2007 Man i am sure you aren't making sense lol... i quote my self No difference in the file those are mime headers so you will know what kind of file this is... There are diff headers for the same file type... And there are no infected images... To be a virus it should be a kind of executable or sth like this.. But anyway i would limit the file size too for more security... you can find it here $_FILES['name']['size'] Kathas Quote Link to comment https://forums.phpfreaks.com/topic/52454-image-file-upload-filtering/#findComment-258838 Share on other sites More sharing options...
oceans Posted May 22, 2007 Author Share Posted May 22, 2007 OK, You took away my sweat on the virus thing!!! OK, Thanks for your warm advice, i am using the size filter. I tried the following: try number 1 if ($_FILES["file"]["type"] == "image/jpg") { } try number 2 if ($_FILES["file"]["type"] == "image/jpeg") { } my file name="image.jpg" any thing i made wrong Quote Link to comment https://forums.phpfreaks.com/topic/52454-image-file-upload-filtering/#findComment-258843 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.