Skip to content

Instantly share code, notes, and snippets.

@kosinix
Last active October 26, 2015 23:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kosinix/3096077936fed20c6258 to your computer and use it in GitHub Desktop.
Save kosinix/3096077936fed20c6258 to your computer and use it in GitHub Desktop.
HTTP multipart form sample request in plaintext and php. Make sure the boundary is correct. Notice that it must have the prefix "--" in the body but not in the header.
Content-type: multipart/form-data, boundary={$boundary}
Content-Length: {$contentLength}
--{$boundary}
content-disposition: form-data; name="field1"
{$field1}
--{$boundary}
content-disposition: form-data; name="field2"
{$field2}
--{$boundary}
content-disposition: form-data; name="userfile"; filename="{$filename}"
Content-Type: application/zip
{$binarydata}
--{$boundary}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment