views:

803

answers:

3

Is it possible to upload a file from a client's computer to the server through a web service? The client can be running anything from a native desktop app to a thin ajax client.

+2  A: 

This article has a pretty nice intro on how to do it...

lomaxx
The Link seems to be broken :-(
A: 

I'm not a master in "webservice", but if you develop the webservice (and the client), you always can convert the binary file to BASE64 in the client (can do in java... and i soupose in ajax too) and transfer as "string", in the other side, in the webservice encode to binary from BASE64...

It's one idea, that's work, but maybe not "correct" in all enviroment.

accreativos
+1  A: 

It's certainly possible to send binary files via web services (eg. SOAP), but you usually have to do some kind of encoding such as base64, which increases the amount of data to send. One of the most efficient ways to send an arbitrary binary file is via an HTTP PUT operation, since there is no encoding overhead. Not all clients necessarily have an easy way to do this, but it's worth looking.

The other side of that coin is how to get the data off the user's disk an on to the network connection. A "thin ajax client" might not have the requisite permissions to read files from the user's disk. On the other hand, a desktop app implementation would be able to do so without any problem.

Greg Hewgill