MATISZON Posted February 2, 2011 Share Posted February 2, 2011 (edited) Hello. I have a problem trying to send binary data (image) using WinHTTP.My script:$f = FileOpen("avek.gif") $dataf = FileRead($f) FileClose($f) $data = 'Content-Disposition: form-data; name="userfile"; filename="avek.gif"' & @CRLF $data &= 'Content-Type: image/gif' & @CRLF & @CRLF $data &= $dataf $http = ObjCreate("winhttp.winhttprequest.5.1") $http.Open("POST", "http://zapodaj.net/upload.html") $http.SetRequestHeader("Connection", "keep-alive") $http.SetRequestHeader("Content-Type", "multipart/form-data") $http.Send($data) MsgBox(0,0,$data) FileDelete("del.html") FileWrite("del.html", $http.ResponseBody)Screen from LiveHTTPHeaderPlease, Help me :] Edited February 2, 2011 by MATISZON [size="3"][font="Arial Black"]I'm from the Polish do not as well know how English[/font][/size] Link to comment Share on other sites More sharing options...
trancexx Posted February 2, 2011 Share Posted February 2, 2011 (edited) You can use WinHttp.au3 for that: #include "WinHttp.au3" ; Initialize and get session handle Global $hOpen = _WinHttpOpen() ; Get connection handle Global $hConnect = _WinHttpConnect($hOpen, "zapodaj.net") Global $sHTM = _WinHttpSimpleFormFill($hConnect, Default, "index:0", "name:userfile", @ScriptDir & "\avek.gif") ; Close handles _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) ConsoleWrite(">Server response:" & @CRLF & $sHTM & @CRLF) Edited February 2, 2011 by trancexx ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
MATISZON Posted February 2, 2011 Author Share Posted February 2, 2011 Your code is working. Can someone show me working code with com object? [size="3"][font="Arial Black"]I'm from the Polish do not as well know how English[/font][/size] Link to comment Share on other sites More sharing options...
MATISZON Posted February 4, 2011 Author Share Posted February 4, 2011 @refresh [size="3"][font="Arial Black"]I'm from the Polish do not as well know how English[/font][/size] Link to comment Share on other sites More sharing options...
autoking Posted September 15, 2012 Share Posted September 15, 2012 Your code is working.Can someone show me working code with com object? Would like that too Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now