HTML input file accept Attribute - Mostlikers

16 July, 2014

HTML input file accept Attribute

 We upload PDF filein database, that time we use Html input type file attribute. but it's accept all type of files. After submitting form only we know wrong upload file format. So avoid that method just give the file accept type to ignore other file types.

Live Demo


<input type="file" accept="application/pdf" />// PDF
<input type="file" accept="application/" />
<input type="file" accept="image/*">//image type only
<input type="file" accept="image/png" />// png format only
<input type="file" accept="image/gif" />// gif format only
<input type="file" accept="video/*">// All video
<input type="file" accept="audio/*">// All audio

No comments:

Post a Comment