0

I have been searching for a jquery multi file upload with file description also coming along with it.

I have found examples like

pluupload

uploadify

https://blueimp.github.io/jQuery-File-Upload/

But I couldn't find in any of the upoader with where I can give a description to the specific file?

If any one have come across such uploaders with file description or any file uploader where how can I extend to use file description

Arun Bertil
  • 4,598
  • 4
  • 33
  • 59

1 Answers1

0

Using dropzone, or blueimp, it's pretty simple to add fields to the upload handler.

Here's a barebones of one of my dropzone scripts with extra post data

The .bind () function is where the fields are added to the submission

    
    
    $('#drop_zone_outer_div').fileupload({

// This element will accept file drag/drop uploading
autoUpload: true,
dropZone: $('#drop_div_id'),
limitMultiFileUploads:1,
maxNumberOfFiles: 1,
fileInput: $('#input_field_id'),
url: 'url_to_file',
dataType: 'text',

// This function is called when a file is added to the queue;
// either via the browse button, or via drag/drop:
add: function (e, data) {

var tpl = $('<li class="working"><p></p></li>');

// Append the original file name and file size
tpl.find('p').text("Submitted File: " + data.files[0].name).append('  <i>' + formatFileSize(data.files[0].size) + '</i>');

// Add the HTML to the UL element
data.context = $(ul).html(tpl);


// upload the file on btn click
$('#btnSubmit').click(function(){
var jqXHR = data.submit();})
},

progressall: function (e, data) {
},
done: function(e, data){

}
}).bind('fileuploadsubmit', function (e, data) {
data.formData = {
name: $('#upload_name_input').val(),
comment: $('#comment_id').val(),
other: $('#other_input').val()
};
});

</script>
</code>
</pre>
TheRealMrCrowley
  • 976
  • 7
  • 24