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
 
This week, we're updating our course layouts and descriptions. Presentation and materials always gently change over time, but just occasionally there's a need to make a step change to clear out some of the old and roll in the new. That's now happening - but over a long and complex site it's not instant and you'll see sections of the site changing up to and including 19th September.

See also [here] for status update
 
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 requests.xyz 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.

Code:
<?php
header ('Content-type: Application/Octet-stream');
header ('Content-Disposition: attachment; filename="hello.txt"');
foreach (file("../data/requests.xyz") as $line) {
       print $line;
}
?>


It's online at http://www.wellho.net/demo/savepeople.php4 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 www.opentalk.org.uk 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., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho