jQuery FileUpload with Laravel and NOT autoupload -
i'm having lot of problems jquery fileupload autoload turned off. need submitted in 1 request--not multiple. have had 3 days of fighting , lots of research. have feeling i'm missing 1 thing. here's got:
jquery:
$(function(){ var ul = $('#upload ul'); // initialize jquery file upload plugin $('#entry_form_doc').fileupload({ type: 'post', url: 'leadresources/submitdoc', limitmultifileuploads: 5, autoupload: false, dropzone: $('#drop'), add: function (e, data) { //fired click of button. $("#submit_doc").unbind('click').on('click', function(){ data.formdata = {files: data.originalfiles}; data.submit(); }); }, fail:function(e, data){ // has gone wrong! data.context.addclass('error'); } });
});
this laravel gets when print_r() log:
[2015-03-16 14:27:27] production.info: array ( [lb_id] => [lb_doc_title] => asdf [lb_docs_summary] => [file] => array ( [0] => symfony\component\httpfoundation\file\uploadedfile object ( [test:symfony\component\httpfoundation\file\uploadedfile:private] => [originalname:symfony\component\httpfoundation\file\uploadedfile:private] => photo 2.jpg [mimetype:symfony\component\httpfoundation\file\uploadedfile:private] => image/jpeg [size:symfony\component\httpfoundation\file\uploadedfile:private] => 498589 [error:symfony\component\httpfoundation\file\uploadedfile:private] => 0 [pathname:splfileinfo:private] => c:\xampp\tmp\php31f9.tmp [filename:splfileinfo:private] => php31f9.tmp ) ) ) [] [] ) [] []
right now, it's returning first object , nothing else. guess makes sense since data.submit being fired on first image , unbinding.
for long time, getting multiple submits, want submitted once filelistarray--not individual file. tried create file list array laravel logs [object filelist] , that's it.
so has else been able fire without autoload , in 1 request--not multiple. have followed documentation talks singlefileuploads still...didn't work.
just curious if else @ wits in this. it's great plugin--just hard figure out.
edit:
i should reason why wanted autoload turned off needed 3 form fields submitted return id first can attach id documents.
this isn't answer (so i'm not going mark it), did find plugin waaaaay less temperamental. ended using dropzone. easier use , had more functionality looking for.
edit asked how did using dropzone. here's how did it:
$("#entrydoc").dropzone({ url: "submitdoc", uploadmultiple: true, maxfiles: 5, paralleluploads: 5, autoprocessqueue:false, addremovelinks: true, thumbnailwidth: 100, thumbnailheight: 100, paramname: 'files', dictremovefile: 'x', dictcancelupload: 'cancel', dictfallbackmessage: 'your browser not support dropzone. please update browser', dictinvalidfiletype: 'file type not accepted. has been removed queue.', dictfiletoobig: 'file big. has been removed queue.', maxfilesexceeded: 'only 5 files can uploaded.', dictresponseerror: 'could not upload files. please try again or reach out developer.', fallback: function(){ $('#entrydoc').html('please update browser.'); }, init: function(){ var mydropzone = this; mydropzone.on("sendingmultiple", function (files, xhr, formdata) { //this form data gets sent on files. formdata.append("action", $('#action').val()); formdata.append("lb_type_code", 'files'); formdata.append("lb_id", $('#lb_id').val()); }); $("#submit_doc").click(function () { var check = formvalidation($('#files_container')); if(!check){ $.jqdialog.alert("you missing required fields."); return false; } mydropzone.processqueue(); }); }, success: function(){ //what want after uploaded }, error: function(file, errormessage){ //error here } });
Comments
Post a Comment