Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Category:
Internet applications
I just went through all this and your code looks ok to me. I'm using Microsoft.XMLHTTP instead of WinHttp.WinHttpRequest though. Do you need to authenticate before you can get access? Are you getting an error? Is there a .ResponseText property to your object? On mine, that contains what was returned from the server.
>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
Previous
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