homepage Welcome to WebmasterWorld Guest from 50.19.169.37
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
download files from database
php page name
brancook




msg:3498750
 3:16 pm on Nov 7, 2007 (gmt 0)

I have some excel files stored in a mysql datatbase that I have displayed in a table. When I click the link to the file and download it, it want's to save the files name as the name of the php page. For instance the link to the file is "fixme.xls" but when I download it and save it to my computer it plugs in "page_name.php" so I have to rename the file to the .xls file name. Is there a way to avoid this?

 

Habtom




msg:3499526
 11:38 am on Nov 8, 2007 (gmt 0)

I have some excel files stored in a mysql datatbase that I have displayed in a table.

I am not going to respond to that specific question, but let you know that you could do this differently if you are not aware of this yet.

Except on very rare cases, it is not recommended to store any kind of file inside a DB. The best way to do is to let the file get stored outside the somewhere in the server and save the file and path in the DB. File is safe, no corruption and no huge sized DBs.

I would recommend you follow this way.

Habtom

joelgreen




msg:3499538
 11:52 am on Nov 8, 2007 (gmt 0)

you should send header with a file name. something like this

$asfname = "desired file name";
header("Content-Disposition: attachment; filename=$asfname");

not sure if it should be enclosed with quotes.

brancook




msg:3500286
 4:01 am on Nov 9, 2007 (gmt 0)

Thanks for the recommendations...

brancook




msg:3501264
 3:54 am on Nov 10, 2007 (gmt 0)

Habtom,

Can you recommend a good tutorial to take a look at for the suggestion that you've made?

brancook




msg:3507649
 7:01 pm on Nov 17, 2007 (gmt 0)

joelgreen,

I actually had what you suggested I just had 'disposition' spelled wrong. Thanks for your help.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved