I load pictures using jQuery fileupload with follow params:
this.$('input[type=file]').fileupload({
dataType: 'json',
autoUpload: false,
url: this.data.url || '/files/upload',
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
previewMaxWidth: 512,
previewMaxHeight: 512,
previewCrop: true
});
Pay attention to line acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
. This line allows only pictures, BUT there is one problem. It's working with hidden files (e.g: file with name .jpg) How to restrict such files?