Training, Open Source computer languages

This is page http://www.wellho.net/forum/Writing-PHP/retrievi ... names.html

Our email: info@wellho.net • Phone: 01144 1225 708225

 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
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.

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho