Note that there are some explanatory texts on larger screens.

plurals
  1. POblueImp/jquery file upload - How do I get the error message if the file type was not accepted?
    primarykey
    data
    text
    <p>I want to use the BlueImp/Jquery File Upload to be able to upload some images to web webserver. I have this JS code which I generated by reading many sources</p> <pre><code> $('#file_upload').fileupload('option', { dataType: 'json', url: '/Upload/UploadFiles', maxFileSize: 5000000, acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, process: [ { action: 'load', fileTypes: /^image\/(gif|jpeg|png)$/, maxFileSize: 20000000 // 20MB }, { action: 'resize', maxWidth: 1440, maxHeight: 900 }, { action: 'save' } ], progressall: function (e, data) { $(this).find('.progressbar').progressbar({ value: parseInt(data.loaded / data.total * 100, 10) }); }, done: function (e, data) { $('#show_image').append('&lt;img src="' + data.result[0].ThumbURL + '" /&gt;'); $('#imgID').val($('#imgID').val() + data.result[0].Id + ','); $(this).find('.progressbar').progressbar({ value: 100 }); }, error: function (e, data) { var a = 1; } }); }); </code></pre> <p>It works because it doesn't upload any file which is not an image, but I would like to be able to get the error messages (in case it exists) to show to the user.</p> <p>In <a href="http://blueimp.github.com/jQuery-File-Upload/" rel="noreferrer">their demo</a> they have some code (jquery.fileupload-ui.js and jquery.fileupload-fp.js) that create "magically" the HTML with the error inside (I am still strugling to understand it).</p> <p>I don't really get if I should use these plugins too and somehow customize the HTML being generated or if it is simpler to get the info manually and populate it.</p> <p>I am pretty new to JS and Jquery, so maybe I am missing something.</p> <p>How do I configure the HTML being generated or how do I get the error message?</p> <p>Thanks, Oscar</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload