Newsgroups : Borland : borland.public.delphi.internet.winsock : 2005 Jun : Program upload with TIDHttp component

www.cryer.info
Managed Newsgroup Archive

Program upload with TIDHttp component

Subject:Program upload with TIDHttp component
Posted by:"Stan Walker" (stan.walk..@compassaerospace.com)
Date:Wed, 22 Jun 2005 06:43:20

I'm trying to upload a file programmatically (Delphi 7, Indy 9) using the
TIDHttp component. The html from the website is:

   <FORM NAME="UpLoadForm" METHOD="POST" ENCTYPE="multipart/form-data"
      ACTION="/salt/IncludeFiles/upload.asp">
   <INPUT TYPE=FILE NAME="FILE1">
   <INPUT TYPE=SUBMIT VALUE="Add File">
   </FORM>

My code (from the HTTPRedirect procedure) is:

    DS := TIdMultiPartFormDataStream.Create;
    R := TStringStream.Create('');
    try
        DS.AddFile('FILE1','c:\Hello.txt','text/plain');
        DS.AddFormField('SUBMIT','Add File');
        try
            myHTTP.Post('https://bpn.boeing.com/salt/IncludeFiles/upload.asp',DS,R);
        except
            on E: Exception do
               MessageDlg('POST error: ' + E.Message,mtError,[mbOk],0);
        end;
        Handled := True;
    finally
        FreeandNil(DS);
        FreeAndNil(R);
    end;

Whenever I run the program I get an "hppt/1.0 404 Object not found" error.
What am I doing wrong?
Thanks in advance.
Stan Walker

Replies:

www.cryer.info
Managed Newsgroup Archive