Hi everyone,

I'm trying to write a PHP script that is meant to conjure up some
string context and force the browser to download this context into a
file.

For this I have used the following header code:

    header("Cache-control: private");
    header("Content-Type: application/octet-stream");
    header("Content-Length: ".strlen($file));
    header("Content-Disposition: attachment; filename=$filename");


where $file is the string to save as a file which value is fetched from
$filename.

This works like a charm. I get my downloaded file and I am happy.

My problem is as follows. I use frames on my site and once I have
managed to download the file I lock the browser until I refresh the
frame from where I did the download. This is annoying.

I have read the documentation on the header() function and I also
checked the RFC for Content-Disposition and noticed you can add
multipart content to a page but all my efforts go awry. The following is
written by me and is my interpretation on how things should look.
Instead of downloading the first content and then displaying the second,
it downloads everything.

Any ideas?

    header("Content-Type: multipart/mixed; boundary=outer");

    header("Cache-control: private");
    header("Content-Type: application/octet-stream");
    header("Content-Length: ".strlen($file));
    header("Content-Disposition: attachment; filename=$filename");

    $fp = fopen($filename, "r");
    fpassthru($fp);

    header("Content-Type: text/html");
    header("Content-Disposition: inline");

    echo "<P>Test</P>";

Thanks in advance,

Archie

---
Archibald Zimonyi
[EMAIL PROTECTED]

"There is no logic like no logic"


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to