i-e-b / jQueryFileUpload.Net

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

Wrapping POST response in JSON object #16

Open B3nCr opened 10 years ago

B3nCr commented 10 years ago

Hi

I've been using your handler with the javascript files from the blueimp repository.

When a file is posted the handler returns an array of JSON objects with the details of the posted files, but the blueimp javascript expects an object with a single field "files" which contains the array.

So in WriteJsonIFrameSafe you have:

    string jsonObj = this._js.Serialize(statusList.ToArray());

and I have:

    string jsonObj = this._js.Serialize(new { files = statusList.ToArray() });

You can see in line 79 in jquery.fileupload-angular.js that the result should contain the files property

    var files = data.result && data.result.files;

I wasn't sure if you've changed your the javascript to match your handler response or if its out of sync with the latest code from blueimp.

I know it's only a one line fix but if you think it applies then I can clone your repo and submit a pull request. It'd be my first real contribution to the GitHub community :)

i-e-b commented 10 years ago

Thanks for the detailed issue :-)

I haven't worked on this code in years, so it's probably quite out of date. Please submit your pull request and I'd be happy to merge it in.

B3nCr commented 10 years ago

Oops, I didn't even think to look if this repo was still active.

It might be a while before I'm not too distracted by other development to come back to this but I'll definitely try to get it done.

I've not looked at the project or solution but how would you feel about me updating the solution to VS2012 and a more recent version of .NET? (I just copied the handler into my app so could use the anonymous type to add the field to the result as my project is .NET 4.5)

I can also ensure that it contains the latest version of the JQuery File Upload scripts if you want

i-e-b commented 10 years ago

I'll see if I can find some time to get everything up-to-date and clean; I have the feeling that most people do the same and copy the handler code.