Posted by Michael S Bykov on 11/12/07 14:52
On Nov 12, 11:37 am, WayneBurrows <wjburr...@gmail.com> wrote:
> Can I save dynamically created data to a text file on the client's
> machine?
>
> Preferrably in a user named file through a save dialog box.
>
> Thanks
>
> Wayne
<?php
$string = "bla bla bla"; // file content
$filename='some.txt';
$mime_type = (PMA_USR_BROWSER_AGENT == 'IE' ||
PMA_USR_BROWSER_AGENT == 'OPERA')
? 'application/octetstream'
: 'application/octet-stream';
header('Content-Type: ' . $mime_type);
if (PMA_USR_BROWSER_AGENT == 'IE')
{
header('Content-Disposition: inline; filename="' . $filename .
'"');
header("Content-Transfer-Encoding: binary");
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-
check=0');
header('Pragma: public');
print $string;
} else {
header('Content-Disposition: attachment; filename="' .
$filename . '.' . $ext . '"');
header("Content-Transfer-Encoding: binary");
header('Expires: 0');
header('Pragma: no-cache');
print $string;
};
?>
if you'll need any explanations - tell me.
[Back to original message]
|