question about post zip file

Giganews Newsgroups
Subject: question about post zip file
Posted by:  Alexandre (alexandrepires20…@yahoo.com.br)
Date: Thu, 1 Nov 2007

Hi,

I am trying upload a zip file with TidHttp, but my code dont work:

Delphi code is:

var
        Strm: TIdMultipartFormDataStream;
    begin
        Strm := TIdMultipartFormDataStream.Create;
        try
            Strm.AddFile('file', 'c:\teste.zip','multipart/form-data');
            IdHTTP1.Post('http://www.mysite.com.br/uploadarq.php', Strm);
        finally
            Strm.Free;
        end;
    end;

PHP code is (uploadarq.php):

<?

$arquivo = isset($_FILES["file"]) ? $_FILES["file"] : FALSE;

if($arquivo)

{

$ziparq_dir = "Pedidos/" . $arquivo["name"];

move_uploaded_file($arquivo["tmp_name"], $ziparq_dir);

echo "ok";

}

?>

What is wrong ?

I am using delphi 7 with indy 10.2.3

Thx

Alexandre

Brasil

Replies