Now if we want allow only pdf,doc, docx format files for file uploading, use the below code
Html
<input type="file" id="file" name="file[]" multiple="multiple" /> |
JQuery Script
if($('#file').val() != '') { $.each($('#file').prop("files"), function(k,v){ var filename = v['name']; var ext = filename.split('.').pop().toLowerCase(); if($.inArray(ext, ['pdf','doc','docx']) == -1) { alert('Please upload only pdf,doc,docx format files.'); return false; } }); } |
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.
Gravity Web Apps headquartered in Delhi, India, is a sophisticated and Hi-Fi computerized advertising organization that is a skill in the field of innovative Website / CRM / ERP/, Designing with software Development, advance and classic Digital Marketing, Search Engine Optimization (SEO) and Brand building furthermore, Applications advancement.
Copyright © 2013, Gravity web apps All Rights Reserved.
Share This Blog