javascript - FineUploader does not show error messages -


if have implemented fine uploader , can upload files. have set allowed extensions allow pdf.

but when try upload , jpg instance nothing happens.

normally not problem see message. works on fineuploader website not me.

hope can me.

code:

createupload({ button: $('#dienstverleningsdocumentuploader'),  endpoint:'/adviseur/profile/dienstverleningsdocument/' + '@model.adviseur.servicedocumentid', messages: $('#dienstverleningsdocumentmessage'), allowedextensions: ['pdf'] });  function createupload(options) { var button = options.button[0];//should jquery $(...) var endpoint = options.endpoint; var allowedextensions = options.allowedextensions || ['doc', 'xls', 'docx', 'xlsx', 'pdf']; var sizelimit = options.sizelimit || 10000000;// 10mb var itemlimit = options.itemlimit || 10; var messages = options.messages || $('#messages'); var complete = options.complete;  return new qq.fineuploaderbasic({     button: button,     request: {         endpoint: endpoint     },     validation: {         allowedextensions: allowedextensions,         sizelimit: sizelimit,         itemlimit: itemlimit     },     callbacks: {         onsubmit: function (id, filename) {             messages.html('<div id="file-' + id + '" class="alert" style="margin: 20px 0 0"></div>');         },         onupload: function (id, filename) {             $('#file-' + id).addclass('alert-info')                             .html('<img src="client/loading.gif" alt="initializing. please hold."> ' +                                   'initializing ' +                                   '“' + filename + '”');         },         onprogress: function (id, filename, loaded, total) {             if (loaded < total) {                 progress = math.round(loaded / total * 100) + '% of ' + math.round(total / 1024) + ' kb';                 $('#file-' + id).removeclass('alert-info')                                 .html('<img src="client/loading.gif" alt="in progress. please hold."> ' +                                       'uploading ' +                                       '“' + filename + '” ' +                                       progress);             } else {                 $('#file-' + id).addclass('alert-info')                                 .html('<img src="client/loading.gif" alt="saving. please hold."> ' +                                       'saving ' +                                       '“' + filename + '”');             }         },         oncomplete: function (id, filename, responsejson) {             if (responsejson.success) {                 $('#file-' + id).removeclass('alert-info')                                 .addclass('alert-success')                                 .html('<i class="icon-ok"></i> ' +                                       '“' + filename + '”' +                                       'succesvol.'                                       );                 if (complete) {                     complete(filename, responsejson);                 }             } else {                 $('#file-' + id).removeclass('alert-info')                                 .addclass('alert-error')                                 .html('<i class="icon-exclamation-sign"></i> ' +                                       'uploaden mislukt bij: ' +                                       '“' + filename + '”: ' +                                       responsejson.error);             }         }     } }); } 

the home page , documentation state fine uploader basic mode not provide ui elements @ all. if using fine uploader basic mode, expected intend build own ui , utilize fine uploader's api , callbacks. error messages, such validation errors, sent onerror callback. can contribute own onerror callback handler , display error messages yourself.

for example, suppose using bootbox.js in app. instance might this:

$('#uploadercontainer').fineuploader({     uploadertype: 'basic',     button: $('#dienstverleningsdocumentuploader'),     request: {      endpoint: '/adviseur/profile/dienstverleningsdocument/' + '@model.adviseur.servicedocumentid',         },     validation: {         allowedextensions: ['pdf'],         sizelimit: 10000000,         itemlimit: 10     }  })     .on('error', function(event, id, filename, reason, maybexhr) {         bootbox.alert(reason);     }); 

notice i'm utilizing jquery fine uploader plug-in in example. should using jquery in project. see documentation more info on plug-in.

if want use default ui comes fine uploader , customize bit, should using fineuploader mode. explained further in documentation.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -