Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Catégorie:
Applications Internet
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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement