ShoeLace1291 Posted May 27, 2007 Share Posted May 27, 2007 How do I make it so my image browse input only allows users to select image files? Quote Link to comment https://forums.phpfreaks.com/topic/53215-only-images-in-browse-inputs/ Share on other sites More sharing options...
textbox Posted May 27, 2007 Share Posted May 27, 2007 Could you explain this a little more please?!? Quote Link to comment https://forums.phpfreaks.com/topic/53215-only-images-in-browse-inputs/#findComment-262913 Share on other sites More sharing options...
ShoeLace1291 Posted May 27, 2007 Author Share Posted May 27, 2007 I have a form that allows users to upload files but I want them to only be able to upload image files such as GIF, JPG, JPEG, PNG, etc. How do I do this? Quote Link to comment https://forums.phpfreaks.com/topic/53215-only-images-in-browse-inputs/#findComment-262915 Share on other sites More sharing options...
AndyB Posted May 27, 2007 Share Posted May 27, 2007 You can't exert any control over what someone attempts to upload. What you can control is what happens to files they upload (to your server's /temp folder). Process images - assuming that's what you want - and do nothing with non-images. When the browser session ends, all files in the /temp folder will be discarded. Quote Link to comment https://forums.phpfreaks.com/topic/53215-only-images-in-browse-inputs/#findComment-262918 Share on other sites More sharing options...
textbox Posted May 27, 2007 Share Posted May 27, 2007 In my upload scripts there is a clause as to what the file will allow. Such as; //allowed Extensions $limitedext = array(".gif",".jpg",".png",".jpeg",".bmp"); This allows me to limit what they can upload. As AndyB says, you cant stop them from trying, but you can return them an error if, say, they tried to upload a .pdf or .doc Quote Link to comment https://forums.phpfreaks.com/topic/53215-only-images-in-browse-inputs/#findComment-262934 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.