I'm designing a RESTful API that should handle binary file uploads.
Should this be done the same way as html form upload or is there a better way?
views:
591answers:
3
+2
A:
Theoretically you should do that with a "PUT" request. However this isn't supported by browsers. That leaves you with the plain html form upload as the only option.
kgiannakakis
2010-01-19 09:04:31
Why PUT and not POST? POST (creating something new) seems more sensible; the file is just payload information.
S.Lott
2010-01-19 13:20:19
@S.Lott - I agree POST can also be used for uploading - if the server chooses the new URI for the resource. See Restful Web Services (Richardson, L; Ruby, S) p.220.
Bedwyr Humphreys
2010-01-29 13:44:06
+3
A:
Take a look at the Amazon api for an idea. It uses a PUT query and then through sendREST it sends the content. Uploading files to Amazon S3 with REST API
Aggelos Mpimpoudis
2010-01-19 09:05:17
A:
A good way is to upload the binary information using streams. You could have a look at the JeCARS client project. To be exact the JC_RESTComm.java class performs the upload.
Waverick
2010-01-19 09:15:54