View Full Version : Best way to send a client-side image to the server (in a non-standard setup)

26 Jun 2009, 2:33 AM

I have this nice thumbnail image view from gxt (using listview and stuff, see examples), and now I also like to offer the ability to upload new images.
In my - a bit special - case the client (gwt) communicates with the server using an xml-rpc api and I've implemented a "upload_image(session, file_content)" method there which can be called from the client (verifies the session and stores the image in a file on the server).

My research so far indicates that it seems not possible (due to javascript security restrictions) to read a file that the user selected (e.g. using a FileUploadField) and send its content via xml-rpc to the server - please correct me if I'm wrong there, that's just what I've read so far. The only way this is possible is using a form and a POST request (in gxt this is abstracted in a FormPanel) - which is then handled by the browser with a php script / servlet / whatever server side technologiy that can handle the post request (which in my case would simply forward it to the xml-rpc interface).
So here's finally my question: Do you know of any other technology I could use ? Or is there a simpler way to do this? (currently I'm in the favor of the small "forwarder php" solution, currently I dont' have a servlet container running and I'd would be a lot of overhead for such a simple task). Do you have any other hints oder pointers for me?

thanks in advance!