acceptFileTypes validation For jQuery upload Plugin

Leave a Comment
This tutorial will help you validate acceptFileTypes if you are using blueimp jQuery File Upload plugin to upload your files.
Please refer this validation in the following in live

Drag and Drop File Upload jQuery PHP Ajax HTML5 MySQL and Bootstrap

Upload Image Extension Validation in jQuery

use this below script to validate acceptFileTypes of image that is jpg,jpeg, png,bmp and etc.
$('#fileupload').fileupload({
     url: 'users/upload',
     acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
     acceptFileTypes: /(\.|\/)(mp3)$/i,
});
You want to validate only png images use like this
$('#fileupload').fileupload({
     url: 'users/upload',
     acceptFileTypes: /(\.|\/)(png)$/i,
     acceptFileTypes: /(\.|\/)(mp3)$/i,
});

mp3 Audio File Validation in jQuery

$('#fileupload').fileupload({
     url: 'users/upload',
     acceptFileTypes: /(\.|\/)(mp3)$/i,
});

mp4 Video File Validation in jQuery

$('#fileupload').fileupload({
     url: 'users/upload',
     acceptFileTypes: /(\.|\/)(mp4)$/i,
});

0 comments:

Post a Comment