[jQuery] [multifile] Programmatic functionality not working
Getting the MultiFile plugin (jQuery Multiple File Upload Plugin
v1.46) working programmatically is not happening for me.
Please see two demos with a class-based and programmatic approach
(view source and check the js files)...the link to switch between them
is at the top: http://monovisiondesign.com/sandbox/multifile/
It works when I apply the plugin through class selectors:
<input class="text multi accept-pdf max-5" type="file" name="pdf_url
[]" id="pdf_url" />
But I would like more control over the functionality. For instance, I
have a select list that determines the number of files that can be
uploaded per a particular selected index and I'd also like to display
a 'remove' image for each selected file, which doesn't appear possible
with the class-based approach. However, when I attempt to run this,
each MultiFile input allows only one file to be selected before
disabling itself.
Any clues as to what I'm doing wrong?
jQuery('#type').change(function(){
var text = jQuery('#type :selected').text();
enableMultiFile(text);
}
function enableMultiFile(text){
jQuery('input:file').MultiFile('reset');
jQuery('#img_url').MultiFile({accept: 'gif|jpg|png', STRING: {
remove: '<img src="http://www.fyneworks.com/@/bin.gif" height="16"
width="16" alt="x"/>'
}});
jQuery('#logo_url').MultiFile({max: 1, accept: 'gif|jpg|png',
STRING: {
remove: '<img src="http://www.fyneworks.com/@/bin.gif" height="16"
width="16" alt="x"/>'
}});
if(text == 'press-releases') {
jQuery('#pdf_url').MultiFile({max: 1, accept: 'pdf', STRING: {
remove: '<img src="http://www.fyneworks.com/@/bin.gif" height="16"
width="16" alt="x"/>'
}});
}else{
jQuery('#pdf_url').MultiFile({max: 5, accept: 'pdf', STRING: {
remove: '<img src="http://www.fyneworks.com/@/bin.gif" height="16"
width="16" alt="x"/>'
}});
}
}
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home