srs81 / CakePHP-AjaxMultiUpload

CakePHP 2 plugin to allow for easy multi-file upload with AJAX
Other
65 stars 33 forks source link

Update View/Helper/UploadHelper.php #26

Closed nicolaszanghi closed 9 years ago

nicolaszanghi commented 11 years ago

Hi,

Thank's for your nice plugin ! Really easy to use, and very simple.

I had a bug with multiple Upload->edit in my View. I found that the JS function createUploader() was execute just once. I change the minimum code to make it work. Surely, is not the best solution but is working for me.

I'm the only one with this bug ?

Nico

srs81 commented 11 years ago

Looks great! Does this work on all browsers?

nicolaszanghi commented 11 years ago

Yes. It's jQuery : http://docs.jquery.com/Browser_Compatibility

srs81 commented 11 years ago

Ah yes, the problem is this plugin in pure Javascript - any way to make this work without jQuery?

nicolaszanghi commented 11 years ago

It's a bit more complicated without jQuery : http://stackoverflow.com/questions/799981/document-ready-equivalent-without-jquery

srs81 commented 11 years ago

True, I agree. :100: Will keep an eye on this and see if its necessary to migrate full to jQuery.

safyrbleu commented 10 years ago

Hi, thank you very much for the plugin and for this update. I was wondering, is it possible to change the label of the uploader? I am using multiple Upload->edit in my View and would like to know whether it would be possible to display different labels for the different 'uploaders', instead of having it display both as 'Files'.

Any suggestion as to how I might achieve this? Thanks once again

safyrbleu commented 10 years ago

I found a solution that works, I'm not sure that it's the best approach, but it works. First, I execute a for loop that assigns a unique id to each

element (from UploadHelper.php: $str = "
" . __("Files") . "
\n
";). After that I look for the element by id and then replace the innerHTML with the label value I want. The code for this looks as such: $('document').ready(function(){ for(var i = 0; i <= 6; i++){ $("dt").each(function(i) { $(this).attr("id", "uploader" + i); }); }
document.getElementById("uploader0").innerHTML="Uploader 1"; document.getElementById("uploader1").innerHTML="Uploader 2"; });

Once again, I am not sure that this is the best approach, and any input would by greatly appreciated. Thanks

srs81 commented 9 years ago

Apologies for the late reply - I've updated this plugin significantly to use Dropzone.js . I don't think these changes will be needed anymore? Let me know.