Lucky2710 Posted October 31, 2010 Share Posted October 31, 2010 I have an upload system on my web site. On the server side of things it only accepts certain file types .gif, .jpg, .png, and .jpeg. How can I make it so that when they are browsing for files with the form <input type="file" name="file" /> that they can only select those same file types. I don't want people to be able to even try and upload anything besides my specified image types! Quote Link to comment Share on other sites More sharing options...
haku Posted November 1, 2010 Share Posted November 1, 2010 If this can be done, it can only be done with javascript. Moving it to that forum. Quote Link to comment Share on other sites More sharing options...
Adam Posted November 1, 2010 Share Posted November 1, 2010 There's no way of doing this with JavaScript. There's the accept attribute for file inputs, however it's not supported by any major browser. The W3C's HTML5 specification of the file input does specify the accept attribute again, so I'm not sure if this will be supported later or not. Quote Link to comment 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.