Tuesday, November 27, 2012

Restrict file upload selection to specific types

// Allow only gif, jpg images 
 
<input type="file" name="pic" id="pic" accept="image/gif, image/jpeg" />
 

// Allow only text, word, pdf documents
 
<input type="file" name="document" id="document" accept="text/plain, application/msword,  
application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/pdf" />

No comments:

Post a Comment