i-e-b / jQueryFileUpload.Net

[Out of Date] .Net handler for http://aquantum-demo.appspot.com/file-upload
68 stars 54 forks source link

send parameter #15

Open erhanfirat opened 12 years ago

erhanfirat commented 12 years ago

Hello, I am using this version of jQueryFileUpload for my .Net project. I want to know that if I send two parameter when uploading files?

i-e-b commented 12 years ago

I'm sorry, I don't understand your question. Could you provide any sample code or scenarios?

erhanfirat commented 12 years ago

Ofcourse, in my project, I have called file uploader in an iframe, and it is shown on our product record relatively. The files which user want to upload, is about my product object. So, when a file upload request send, I also want to learn that which record and field it is related. I should send "productId" and "fieldName" parameters for each file upload request. Is this possible?

i-e-b commented 12 years ago

You should be able to. I haven't worked on this in a few months, so I'll take a look at the project and let you know more details.

erhanfirat commented 12 years ago

I found these;

https://github.com/blueimp/jQuery-File-Upload/wiki/How-to-submit-additional-Form-Data

And bind events works only as below:

$('#fileupload').fileupload({ add: function (e, data) { console.log('add'); data.submit(); }, progress: function (e, data) { console.log('progress'); }, start: function (e) { console.log('start'); } }).bind('fileuploadadd', function (e, data) { console.log('fileuploadadd'); }).bind('fileuploadprogress', function (e, data) { console.log('fileuploadprogress'); }).bind('fileuploadstart', function (e) { console.log('fileuploadstart'); });

[Sebastian Tschan: http://stackoverflow.com/questions/6280360/why-doesnt-blueimps-jquery-file-upload-plugin-fire-callbacks/6973703#6973703]

ALthough, I still cannot figure out why "fileuploadsubmit" callback does not fire, I can send extra data now by using these bindings.

erhanfirat commented 12 years ago

Hello again,

I can send data now, as I mention above, however, now, I want to send these data for listing existing files.

Here is the code written in the "application.js":

// Load existing files:
$.getJSON($('#fileupload form').prop('action'), function (files) {
var fu = $('#fileupload').data('fileupload');
fu._adjustMaxNumberOfFiles(-files.length);
fu._renderDownload(files)
   .appendTo($('#fileupload .files'))
   .fadeIn(function () {
      // Fix for IE7 and lower:
      $(this).show();
    });
});

Can I add some data before listing files?