Hack Forums
Multipart/Form-data (uploading http) - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: Multipart/Form-data (uploading http) (/showthread.php?tid=4079034)



Multipart/Form-data (uploading http) - topLevel - Feb 23, 2014

Here you go.

picArray[] is the file data.

Code
Local $boundary = "a65h7a" & @CRLF
Local $boundary2 = "--" & $boundary
Local $binary = "Content-Transfer-Encoding: binary" & @CRLF
local $typeCon = "Content-Type: txt/html" & @CRLF & @CRLF
Local $postData = $boundary2

$postData &= 'Content-Disposition: form-data; name="file[]"; filename="1.txt"' & @CRLF
$postData &= $typeCon
$postData &= $picArray[1] & @CRLF
$postData &= $boundary2
$postData &= 'Content-Disposition: form-data; name="file[]"; filename="2.txt"' & @CRLF
$postData &= $typeCon
$postData &= $picArray[2] & @CRLF
$postData &= "--a65h7a--"            ;End of HTTP HEADER

;begin send
$oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", $upshot, False)
$oHTTP.SetRequestHeader("Content-Type", "multipart/form-data; boundary=" & $boundary)
$oHTTP.Send($postData)