Page 1 of 1

blob download

Posted: Fri Nov 17, 2006 9:45 am
by recluse8912
I'm having a problem downloading a pdf from a MySQL blob. What I'd like to do is have the download box pop up asking whether to 'open' or 'save' the file. Right now, the user clicks on a download link which opens a page that grabs the file from the blob:

$filename = mysql_result($result, 0, 'file');

Is there a way in PHP to take that $filename variable and cause a download dialogue box to pop up allowing the user to pick whether that want to open or save it?

Thanks!

Posted: Fri Nov 17, 2006 9:53 am
by evilchris2003
Couldnt you use the html to open the save file dialog box where the location = a varible pointing at a specific file

Posted: Fri Nov 17, 2006 10:03 am
by pickle
Goofing with the MIME headers that get sent can affect what happens. Do a search (either here at devnet or on Google) for 'PHP force download'.

Download

Posted: Fri Nov 17, 2006 10:04 am
by timclaason
I think that's more of a OS thing.

You could do:

Code: Select all

Header("Location: ". $filename);

Re: Download

Posted: Fri Nov 17, 2006 10:25 am
by John Cartwright
timclaason wrote:I think that's more of a OS thing.

You could do:

Code: Select all

Header("Location: ". $filename);
The database is holding the binary data, not the file system.