I am using jQuery File Upload Plugin 5.21
to upload files to my site. My need is to show error message instantly when a file type not like image is added(by checking file extension). how to use built in function to check this operation like _onSend
_beforeSend
but not aware of using it.
(If possible can show a demo?).Thankx in advance
Asked
Active
Viewed 836 times
0

Vishnu Prasad
- 729
- 1
- 11
- 28
-
You want code for this? – santosh singh Sep 30 '14 at 07:16
-
@geek if their is any example. it will be more helpful. thank you – Vishnu Prasad Sep 30 '14 at 08:25
1 Answers
3
You can use below code.
- JavaScript
add: function (e, data) {
var goUpload = true;
var uploadFile = data.files[0];
if (!(/\.(gif|jpg|jpeg|tiff|png)$/i).test(uploadFile.name)) {
common.notifyError('You must select an image file or your message.......');
goUpload = false;
}if (goUpload == true) {
data.submit();
}
},

prog1011
- 3,425
- 3
- 30
- 57
-
i was trying to use _onAdd. i'll check this. thank you for your ans – Vishnu Prasad Sep 30 '14 at 08:28