Set Content-Type to application/json in response #7

Open
aaronchi opened this Issue Apr 20, 2012 · 4 comments

3 participants

@aaronchi

I noticed that the plugin doesn't work if you actually return a json response. It seems to only work if you send a text/html response with json in it. I assume this is due to the way that the response is being parsed in the javascript.

Great start on a simple upload plugin though. Would be great to extend it and include a list view as well with a configurable endpoint for pulling in the image details.

Thanks!

@PerfectlyNormal

Yeah, I know it has a few warts. Found some code that did the job, packaged it and played around 'til I got it working "good enough" for my needs. Planning on making it a bit nicer as time permits.

I see I forgot to mention the content_type bit. Wrote a short line in the readme, and I'll see if I can't get that fixed as well. Thanks for letting me know.

@PerfectlyNormal

Gave this a little try today, and got it working in Safari, Chrome and the likes when using application/json or text/javascript or pretty much any encoding. Only problem was IE, who attempts to download it the second something other than text/html gets sent.

So from what I can see while researching, as long as we use a iframe for the uploading (which needs to be done to support IE and Opera), the content-type needs to be text/html or text/plain

@Darkside73

Can you publish your efforts as a branch? I'm don't care about IE and Opera

@PerfectlyNormal

Hi.

I'm terribly sorry, but looks like I don't have that any more. I've moved machines since I played around with that, and that little experiment disappeared.

Don't really remember how I did it either. Sorry about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment