HTTP / JSON protocol
Data/files can be uploaded over HTTP by using the POST
method and "multipart/form-data"
encoding, or using a PUT
For the PUT
request the body is the data. In this case you must send all your parameters as part of the request. PUT
can upload just one file, POST
can do multiple files.
If a filename is needed it must be passed in filename parameter.
When uploading files you can skip passing the "Content-Length"
header if it is hard or impossible to compute. If you are using POST
method, you have a proper way of indicating end of upload - boundary with trailing --
If you are using PUT
method you can only indicate end of stream by closing the connection in this case (closing the sending end and still reading the reply of course will work).