Re: idHTTP upload a zip file with POST method

Giganews Newsgroups
Subject: Re: idHTTP upload a zip file with POST method
Posted by:  Fahd (fahd…@quickpractice.com)
Date: Fri, 16 Jun 2006

you're right, and I apologize for being unclear. And yes, I'm accessing a
https website. I added the SSL-enabled IOHandler and it worked just fine,
I didn't know that we had to do all this with delphi, too much headaches. I
created the same app under C# .net 2.0 in an hour.
thank you so much, that was helpful
Fahd

"Fahd" <fahd…@quickpractice.com> wrote in message
news:604C34159EFCE240fahd…@quickpractice.com...
> If I run this code I get an error message saying "Error encountered during
> POST: IOHandler value is not valid -1
> I don't know why is giving me -1 because I don't see anything wrong with
> my code!!
> please help thank you
>
> Fahd
>
>  PostStream := TIdMultiPartFormDataStream.Create;
>  ResponseStream := TStringStream.Create('');
>
>  try
>    IdHttp1.Request.ContentType := PostStream.RequestContentType;
>    PostStream.AddFormField('wsUserID', sUserID);
>    PostStream.AddFormField('wsPassword', sPassword);
>    PostStream.AddFormField('wsMessageType', sMessageType);
>    PostStream.AddFile('wsPutFile', path, 'multipart/form-data');
>    with IdHTTP1 do begin
>      try
>        Request.ContentType := PostStream.RequestContentType;
>        post(sURL, PostStream, ResponseStream);
>      except
>      on E: Exception do
>          showmessage('Error encountered during POST: ' + E.Message+ ': '
> +intToStr(IdHTTP1.Response.ResponseCode));
>      end;
>    end;
>  finally
>    Memo1.Lines.Text :=ResponseStream.DataString;
>    PostStream.Free;
>    ResponseStream.Free;
>  end;

Replies

None

In response to

idHTTP upload a zip file with POST method posted by Fahd on Fri, 16 Jun 2006