Diego
Diego

Reputation: 1

On client, how do I download an image, then send as POST request to third party server?

We're using GWT and want to download an image to the client, then send this image to another server using a POST request...

A JavaScript/AJAX solution would be helpful too.

Is this plausible? Can a web app access cached images from the client's browser?

We're rookies, if this is futile please let us know. Thanks!

UPDATE: We abandoned this approach. After doing some research it seems that the only way one can set a multipart body request is through an HTML form, even then the client has to specify what file she wants uploaded. It makes perfect sense from a security standpoint. What we were trying to do was basically route an image image from server to client to server... thanks for the help.

Upvotes: 0

Views: 406

Answers (2)

Isaac Truett
Isaac Truett

Reputation: 8874

You could use a privileged Applet or Flash, but basic JavaScript won't do it.

Or maybe just send the image URL to the foreign server with JSONP and let that server download the image itself?

Upvotes: 2

Aren
Aren

Reputation: 55946

Ajax, or asynchronous get/post cannot cross domains. You can only achieve this by having a hidden form, modifying the action parameter, and then using javascript to execute the submit on that form.

I'm sorry to say, I don't know how to go about that in GWT (been a long time since i used it), but that's the algorithm.

Upvotes: 0

Related Questions