"Bryan Tong Minh" <bryan.tongminh(a)gmail.com> wrote in message
news:fd5886130910210324l409d2cc6m31831366ae4bb737@mail.gmail.com...
On Wed, Oct 21, 2009 at 12:15 PM, Jan Luca
<jan(a)jans-seite.de> wrote:
[...]
Content-Type: multipart/form-data
Content-Length: ".strlen($file)."
Content-Disposition: form-data; name=\"".$filename."\";
filename=\"".$filename."\"
".$file."
\r\n\r\n";
You do set your content-type to multipart/form-data, but your content
is not actually multipart/form-data encoded. A multipart/form-data
encoded request looks something like this:
POST / HTTP/1.1
Content-Type: multipart/form-data; boundary=abc
Content-Length: 1234
--abc
Content-Disposition: form-data; name="%s"; filename="%s"
Content-Type: application/octet-stream
<FILECONTENT>
--abc
What is the second "%s" in the above line? Is this instead of having a
separate form-data element with name="filename", or is it a duplicate of
that element, or is it something entirely different?
I note that RFC 2388 says: "The original local file name may be supplied as
well, either as a "filename" parameter either of the "content-disposition:
form-data" header or, in the case of multiple files, in a
"content-disposition: file" header of the subpart. The sending application
MAY supply a file name; if the file name of the sender's operating system is
not in US-ASCII, the file name might be approximated, or encoded using the
method of RFC 2231."
If RFC 2388 says that the sending application MAY supply a file name, why is
the API treating this as a REQUIRED parameter?
Russ