Form Integration
Integrate the uploader with a standard HTML form. File GUIDs are stored in hidden inputs and submitted with the form.
var hiddenInputs = document.getElementById('hiddenInputs');
var uploader = new MultipleUpload(el, {
uploadUrl: '/api/upload',
autoUpload: true,
onTaskComplete: function(task) {
// Add hidden input with file GUID for form submission
var input = document.createElement('input');
input.type = 'hidden';
input.name = 'fileGuids[]';
input.value = task.response.fileId || task.id;
hiddenInputs.appendChild(input);
}
});
form.addEventListener('submit', function(e) {
var formData = new FormData(form);
// formData now includes title, description, and all fileGuids[]
});