Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapping POST response in JSON object #16

Open
B3nCr opened this issue Nov 8, 2013 · 3 comments
Open

Wrapping POST response in JSON object #16

B3nCr opened this issue Nov 8, 2013 · 3 comments

Comments

@B3nCr
Copy link

B3nCr commented Nov 8, 2013

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
Copy link
Owner

i-e-b commented Nov 8, 2013

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
Copy link
Author

B3nCr commented Nov 8, 2013

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
Copy link
Owner

i-e-b commented Nov 8, 2013

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants