On Friday, May 24, 2013 02:15:37 PM Dan Egli wrote: > I am designing a web site in PHP. One of the things that the site will > allow is to download various files. The files are stored in a postgres > table and extracted as needed (that's how the guy I'm designing it for > wants it. I am sure it would be easier to simply store filenames & paths in > the DB but he doesn't want that). The problem I have is that I'm not sure > how to inform the web browser that the filename to save isn't the filename > of the php file. I.e. if the download URL is > get_file.php?filename=example.zip then how do I tell the web browser that > the file's default name is example.zip and not get_file.php?
Check out the Content-Disposition header. PHP docs have a little bit about this: http://php.net/manual/en/function.http-send-content-disposition.php -- Doran L. Barton <[email protected]> - Linux, Perl, Web, good fun, and more! "You are welcome to visit the cemetary where famous Russian and Soviet composers, artists, and writers are buried daily except Thursday." -- Seen in the lobby of a Moscow hotel across from Russian Orthodox monastery /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
