0

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

Vishnu Prasad
  • 729
  • 1
  • 11
  • 28

1 Answers1

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