Re: Tar Files and send back to browser
| From: | Erwin | Date: | Thu, 26 Sep 2002 10:17:33 +0000 |
| Subject: | Re: Tar Files and send back to browser | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117689@lists.php.net to get a copy of this message | ||
Sascha Braun wrote:
> Hi,
>
> I want to make some people download files the server tar's on demand.
>
> But i don't know really how to send the files back to the browser.
>
> I used the following command for taring the file:
>
> <?
> $command = 'tar -c '.$arrResult['name'].'.tgz
> ../images/'.$arrResult['image'];
> system($command);
> ?>
>
> This command starts taring, I think, but fills the browser window
> with the pure code of the tar file I belive. How can I make it behave
> different. When I search for the tar on the webserver I can't find it
> anywhere.
You have to send the appropriate headers to the browser, or PHP will send
the default (text/plain) header. For a tar file the correct header is
application/x-tar, send it with
Header( 'Content-Type: application/x-tar' );
HTH
Erwin