General information
Category:
Internet applications
Title:
Problem with WinHttp
Hi All
It's the first time I use WinHttp and I try to send a file with WinHttp.WinHttpRequest to a website, they use a php script.
But they dont recive the file
What is wrong wityh my code ?
This is my code
lcFichier = FiletoSTR('c:\BenoitM.txt')
WinHttpReq=Createobject("WinHttp.WinHttpRequest.5.1")
winHttpReq.open('POST','http://***.********.**/*******/upload.php',.f.)
winHttpReq.SetRequestHeader("Content-Type","text/html")
winHttpReq.SetRequestHeader("Enctype","multipart/form-data")
winHttpReq.Send(lcFichier)
They give me a exemple in delphi
procedure TFormConfirmAuto.SendFileHTTP(Fichier: String);
var
MultiPartFormDataStream: TIdMultiPartFormDataStream;
begin
MultiPartFormDataStream := TIdMultiPartFormDataStream.Create;
try
//"Joint" le fichier
MultiPartFormDataStream.AddFile('userfile', Fichier, 'multipart/form-data');
MultiPartFormDataStream.Position := 0;
//Post !
IdHTTP1.Post('****://***.********.**/*******/upload.php', MultiPartFormDataStream);
finally
MultiPartFormDataStream.Free;
end;
Thanks for any tips
Benoit
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only