I am using an acronym script to upload a file, select the engine file and via HTTP post command From the file will send the file, the documents say that the postal message is such:
accept the post /handler.cfm HTTP / 1.1: text / * content-type: multipart / form-data; Range = ---------- Ij5ae0ae0KM7GI3KM7ei4cH2ei4gL6 User-agent: Shockwave Flash Host: www.example.com Content-Length: 421 Connection: Keep-alive Cash-Control: No-Cash ------- ----- Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7 Content-presentation: Form-data; Name = "filename" MyFile.jpg ------------ Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7 Content-presentation: Form-data; = "Photo" name; Filename = "MyFile.jpg" content-type: application / octet-stream file data ------------ Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7 Content-presentation: Form-data; Name = "submit" question ------------ Ij5GI3GI3ei4GI3ei4KM7GI3KM7KM7--
On the server side, I listen to a C ++ program on port 80 And parses the post message. I only want the file name and file data How to decode file data using C ++, this base is 64 encoded and can any library do this for me? I want to decode the binary, and want to write it in the file, thanks!
No, no encoding The body of each sub-side of the multilateral message is included as a verbatim bytes. Consequently, you have to be careful to select a border
string that does not come anywhere in the file data.
To submit a multilevel / form-data form, you would be sufficient to parser a MIM parser, like border
and name
, And select the parameter by dividing the message received by the boundary string. This is not completely trivial, so you may wish.
(Unfortunately, the browsers that actually do this are slightly different from the standard MIME rules mentioned in them. Specifically, field names and filename parameters are included in non ASCII characters and unsecad quotes. If you are posting yourself, then hopefully you can dispute the disputes in these areas.)
Comments
Post a Comment