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' );


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to