Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
Python, Lua and Tcl - public course schedule [here]
Private courses on your site - see [here]
Please ask about maintenance training for Perl, PHP, Java, C, C++, Ruby, MySQL and Linux / Tomcat systems
retrieving blobs with names

Posted by ggeezz (ggeezz), 2 November 2004
I have a question similar to questions that have been answered here.  I have a php application that is storing files as blobs in a MySQL database.  I am accessing the files with something like <a href=file.php?id=xx>.  

This is working fine, except that when someone saves the file the default file name is file.php.  I have the filename stored in the table but do not know of any way to make the browser take the default name.  Anyone have any ideas?

Posted by admin (Graham Ellis), 3 November 2004
Hello ...

Here's a program called savepeople.php4 that sends the contents of a file called out to your browser and saves it there as a file called hello.txt.  I think it's the sort of thing that you're lloking for / will be able to adapt.

header ('Content-type: Application/Octet-stream');
header ('Content-Disposition: attachment; filename="hello.txt"');
foreach (file("../data/") as $line) {
       print $line;

It's online at if you want to try it out.

Posted by ggeezz (ggeezz), 3 November 2004
That was what I was looking for.  Thank you very much.

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2018: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: • WEB: • SKYPE: wellho