Hi.
I'm rather confused with forcing a download. I just want to save dynamic content (from $_SESSION[''] data) as a .html file.
The script to do this is a PHP page, but when I click on "download" it downloads as "download.php"
Here's the code:
Code: header("Cache-control: private"); //IE 6 Fix
if (isset($_GET['download']) && $_GET['download']=="true" && isset($_GET['filename']) && $_GET['filename']!="") {
// retrieve content of the file here, e.g. from a database...
$content=$_SESSION['old_page'];
// send the header here
header('Content-type: text/plain');
header('Content-Disposition: attachment; filename="' . $_GET['filename']);
// put the content in the file
echo($content);
// stop processing the page
exit;
}
It's accessed using: Code: <a href="../outputs/download_as_file.html?download=true&filename=shine_output.html">Download</a>
Any suggestions? I found a good tutorial here: http://richardlynch.blogspot.com/2006/06/php-downloads-content-disposition.html but don't think it'll do what I need to do
Header redirect
Hello ive got a problem ive got form with its action set to itself.Code: <form id="formID" class="formular" method="post" action=""/>it then runs
How would I protect......
I have a from, actually, a good amount of forms. How can I make it so you can't type the characters: '!~*&^%().;-_ in the form? Where it completely blocks those characters
Getting Resource id #11 while trying to connect..
So i tried using "DEFINE" for the first time and im using the variables i defined to connect but it reports back this error:QuoteWarning: mysql_query(): 11 is not a valid MySQL-Link resource
File upload issues
Hi Guys,Can anyone see any issues with this code:Code: $setImage= 'productimages/' . date(U) . $HTTP_POST_FILES['setImage']['name'][0];copy($HTTP_POST_FILES['setImage']['tmp_name'][0], $setImage);Its
Print 'a' to 'z' via for loop
A very simple problem..How Can I print a to z NOT a to y ?It is a part of a code where | $alpha= 'a';for($alpha='a';$alpha!='z';$alpha++){echo $alpha.' ';} Output: a b c d e f g h i j k l m n o p q
Email/MMS to Site
Hey guys. I'm looking for a way for a user to upload images and/or text via their cell phones. It could be MMS but since most phones have email these days, maybe just a way to process email. I've
Uploading Filetypes and placing them in seperate folders.
Hello, first post , and asking for help im afraid. Very new to PHP, was making good progress I thought , but im stuck with this part. I have a uploading form that works perfectly and uploads
PHP MySQL and DATE
Hi everyoneI have a databse and in one of the columns I have date values such as 2009-March-27. If i have a php interface and want to use a query to select all the rows that is in say october. how
PHP Redirecting
Hello everyone. Is there a way to redirect people to pages within a statement in PHP? Since there is output before this redirect i cant use the header function.Thnx for your time
Using unserialize()
Hi there.I have some data in my database that is serialized.e.g. a:2:{i:0;s:9:"Test";i:1;s:4:"Another Test";}I'm unsure how to use unserialize to convert it into a string in the