tags:

views:

400

answers:

1

I'm currently implementing a client application that POST's a file over HTTP and have implemented base64 encoding on the file's data parameter.

However, it appears that when inspecting the traffic between a simple HTML page with a file upload form and the server that no Content-Transfer-Encoding header is sent in the body when describing the file's parameter.

Is this the preferred way of POST'ing a file over HTTP?

+1  A: 

No, the preferred way is using multipart/form-data encoding, exactly as you would use with HTML form based file uploads.

BalusC
Sorry, this is unclear in my previous question. The whole request body is multipart/form-data. I am asking specifically about the specific parameter containing the file data.
andybee
The encoding specification doesn't tell anything about the need to encode the parts as Base64, so the answer is still no. It would only make it unnecessarily complicated and incompatible with existing multipart/form-data parsers because they don't expect the values been encoded in Base64 and you thus need to decode them yourself afterwards.
BalusC
OK, thanks for the speedy response!
andybee