pekebyte / pekeUpload

jQuery html5 file uploader plugin
http://pekebyte.github.io/pekeUpload
Other
82 stars 73 forks source link

how to use the data options? #8

Closed kiro112 closed 9 years ago

kiro112 commented 11 years ago

i have try many fomats.. but my api cannot read the data..

nd3w commented 11 years ago

Yes, a sample will be fine.

kiro112 commented 11 years ago

well.. i modify some codes in the plugins myself and then my data.options is working :)

nd3w commented 11 years ago

kiro112, if you don't mind, would you share your code?

kiro112 commented 11 years ago

change this( in pekeUpload.js) :

var formData = new FormData(); formData.append(options.field, obj[0].files[0]); formData.append('data', options.data);

----------------- to this ---------------- var formData = new FormData(); formData.append(options.field, obj[0].files[0]);

var keys = Object.keys( options.data ); var values = options.data; for(var i=0; i<Object.keys( options.data ).length; i+=1){ formData.append( keys[i], values[ keys[i] ] ); }

then request data like this data: { name :'value', status:'Accepted', value2: $('selector').val() }

nileshyadav326 commented 9 years ago

Thanks Missing this is documention