Jump to content

Form file upload browse button question


Lucky2710

Recommended Posts

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!

 

Link to comment
https://forums.phpfreaks.com/topic/217386-form-file-upload-browse-button-question/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.