Posted
The Multi File Upload Widget allows you to upload more than one file from the form in the same element. Here's how to set it up:
- On the Elements tab drag a copy of the widget from the Widget elements group into the Preview box.
- Set the element name - including the [], the number of file uploads you want to allow and any other settings you need.
- On the Actions tab drag an Upload Files action into the On Submit event.
- Configure the Upload Files action as normal adding the name of the Multi File Upload *without the []* in the Fields Configuration box with the file types and also on the Advanced tab in the Array Fields box.
- If there are no other File elements in your form you will need to add enctype="multipart/form-data" into the Form tag attachment box on the Form General tab (click the Form Name link in the Forms Manager to open it).
The ToolTip and Instructions to Users options don't work on this widget :-(
Translate 'Attach File'
Unfortunately the words 'Attach File' are hard-coded into the widget. You can change them using a little JavaScript in your form:
window.addEvent('domready', function() {
$$('a.multi-upload-add-attachment').each(function(el) {
el.innerHTML = 'Bifoga fil';
});
});
Replace the highlighted words with the text you want to show.
Open the first file loader when the page loads
You can add this script snippet to a Load JS action on your form's On Load event. It will automatically ‘click the link’ to show the first file upload when the page loads.
window.addEvent('domready', function() {
var mu_widget = $$('.multi-upload-add-attachment-link a');
mu_widget[0].onclick();
});
Note: this works for me in FF, Chrome and IE10 but is a bit basic so will probably also open a new uploader if you re-load the form for any reason! As written it will also only work on the first widget on the page if you have more than one.