Alex87 Posted January 12, 2020 Posted January 12, 2020 Hi everyone! Good luck and have a nice day... i have some trouble with one task.... i need to send *.png file I tryed it by this one : $binary = FileRead('1.png') ;$boundary = "-----" & Random(10000000, 99999999, 1) $postpacket = $boundary & @CRLF & _ 'Content-Disposition: form-data; name="file"; filename="1.png"' & @CRLF & _ 'Content-Type: image/png' & @CRLF & @CRLF & _ $binary & @CRLF & _ $boundary & '--' & @CRLF $SendData = StringToBinary($postpacket,1) Local $oRequest = ObjCreate('WinHttp.WinHttpRequest.5.1') $oRequest.Open('POST', 'https://site.com/in.php?key=123456', 0) $oRequest.SetRequestHeader('Content-Type', 'multipart/form-data; boundary=') $oRequest.SetRequestHeader('Content-Length', BinaryLen($binary)) $oRequest.Send($SendData) Local $sResp = $oRequest.ResponseText MsgBox(16,'$sResp',$sResp) But i really dont know how to connect correctly my *.png file .... I always get answer from server : "No file" or "Zero file size". Have any idea?
Guest Posted January 12, 2020 Posted January 12, 2020 First of all, welcome to the forum ! You only need to type some search terms in Google to receive suggestions, e.g. : <Autoit Send *.jpg multipart request> or <Autoit Send image multipart request> The WinHttp-UDF from @trancexx is also very helpful, see e.g. : upload-file-by-winhttp
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