blob download

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
recluse8912
Forum Newbie
Posts: 4
Joined: Fri Nov 17, 2006 9:44 am

blob download

Post 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!
User avatar
evilchris2003
Forum Contributor
Posts: 106
Joined: Sun Nov 12, 2006 6:43 am
Location: Derby, UK

Post by evilchris2003 »

Couldnt you use the html to open the save file dialog box where the location = a varible pointing at a specific file
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post 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'.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
timclaason
Forum Commoner
Posts: 77
Joined: Tue Dec 16, 2003 9:06 am
Location: WI

Download

Post by timclaason »

I think that's more of a OS thing.

You could do:

Code: Select all

Header("Location: ". $filename);
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Re: Download

Post 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.
Post Reply