On Tuesday 03 December 2002 15:02, Beau Hartshorne wrote:
> Hi,
>
> I'm working on a system that allows users to upload and then download
> pdf files. Each file is related to a mySQL database entry. To keep
> things simple and consistent, I'd like to store the pdf files like this
> on the server:
>
> [PRIMARY_KEY].pdf
>
> But when a user downloads the file, I'd like them to receive something
> like:
>
> [TITLE].pdf
>
> Is there a way to get php to rename the file when a user tries to
> download it?

This is all done via HTTP headers.

example:

header('Content-type: application/octet-stream');
header(sprintf('Content-disposition: inline; filename=%s', $fileName));
header(sprintf('Content-length: %d', $fileLength));
// Output file now.

Hope this helps.


>
> TIA,
>
> Beau

-- 
Regards,
        William Bailey.
        Pro-Net Internet Services Ltd.
        http://www.pro-net.co.uk
        http://wb.pro-net.co.uk


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to