Re: question about post zip file

Giganews Newsgroups
Subject: Re: question about post zip file
Posted by:  Remy Lebeau \(Indy Team\) (
Date: Thu, 1 Nov 2007

"Alexandre" <alexandrepires20…> wrote in message

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

Just saying that it doesn't work says nothing about the actual problem you
are having with it.  You need to be more specific.  What exactly is going
wrong with it?  Have you tried debugging the PHP code at all to see if the
data is even arriving?  There have been known bugs in PHP's file upload
capabilities, especially if the source and destination folders are on
different file systems.  Have you checked for all available fixes for PHP?

> Strm.AddFile('file', 'c:\','multipart/form-data');

You are using the wrong ContentType for the file.  That is the ContentType
that needs to be used for the actual HTTP request (which TIdHTTP will handle
internally for you), not for the individual file.  Use the
GetMimeTypeFromFile() function to get the correct ContentType for the file,

    Strm.AddFile('file', 'c:\',

> PHP code is (uploadarq.php):

Try this:

        $arquivo = $_FILES['file'];
        $ziparq_dir = 'Pedidos/' . $arquivo['name'];
        if(move_uploaded_file($arquivo['tmp_name'], $ziparq_dir))
            echo "ok";
            echo "uploaded file was not moved";
        echo "uploaded file is not available";



In response to

question about post zip file posted by Alexandre on Thu, 1 Nov 2007