have the file download in a popup window.

after the down load the window will be gone.

Then you don't have to worry about the refreshing of the main window.

Jim
----- Original Message -----
From: "David Miller" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, March 06, 2003 8:30 AM
Subject: [PHP] File Download


> Hello
>
> I have a script that after login gives the user access to one directory.
The
> directory depends on their login.
>
> After login a list of files is displayed with a check box in front of each
file.
> Under the list of files there are several buttons, Copy, Delete, Rename,
Upload, and
> Download.  When you check a box, and select a a button, lets say copy, you
are given
> a new window to enter the new name.  Once entered and you select continue
the a copy
> is made and the list of files is refreshed, displaying also the new file.
All the
> buttons function this way except the download which is where I have
problems.
>
> I a file management class I have a function for each operation.  The code
for the
> download function is as follows:
>
>      function downloadFile($filename)
> {
>     $result = "";
>     if(file_exists($this->_memberDir . "/" . $filename))
>     {
> header("Content-type: application/octet-stream");
> header("Content-Disposition: attachment; filename=$filename");
>                  header("Pragma: no-cache");
> if (!readfile($this->_memberDir . "/" . $filename))
>     $result = $filename . " successfully downloaded<br>";
>     }
>     else
>     {
> $result = "Download Failed for " . $filename . ", does not exist<br>";
>     }
>     return $result;
> }
>
>
> When this function runs, I get the download box that allows the user to
select where
> they want to save there file and a file gets saved.  After this code
returns the
> $result should be printed at the top of the browser window and the list of
files
> displayed again.  What happens is the results and the list of files, the
html code
> for the next screen, is appended to the end of the file that was
downloaded.  I can
> put an exit() inplace of return and I get the correct file size downloaded
but I
> still don't get my screen refreshed.  I would think that I should be able
to put
> another header statement after the download to indicate the no more data
goes into
> the file but is to be displayed by the browser.  I can't figure out how to
get this
> to work.
>
> Thanks
>
> David Miller
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



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

Reply via email to