Upload files via web services

Can I upload a file from a client computer to a server through a web service? The client can run anything from its own desktop application into the ajax thin client.

+4
source share
2 answers

Of course, you can send binary files through web services (for example, SOAP), but usually you need to do some kind of encoding, such as base64, which increases the amount of data sent. One of the most efficient ways to send an arbitrary binary is to use the HTTP PUT operation, since there is no overhead. Not all customers necessarily have an easy way to do this, but it's worth a look.

The other side of this coin is how to get data from a user drive to a network connection. The ajax thin client may not have the required permissions to read files from a user drive. On the other hand, a desktop application implementation could do this without any problems.

+1
source

I am not a master at "webservice", but if you are developing a webservice (and client), you can always convert the binary to BASE64 in the client (can be done in java ... and I also suggest in ajax) and wrap it as a "string", on the other hand, into webservice encoding in binary with BASE64 ...

This is one idea, this work, but maybe not the β€œright” in all environments.

0
source

Source: https://habr.com/ru/post/1276340/


All Articles