Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Save file as attachment
March 27, 2007, 7:32 pm
rate this thread
I talked about this some time ago somewhere else, now I am working
with this again...
I want to offer the user to save/open a file, instead of the browser
opening it by itself (as e.g. a jpeg picture would).
Looking into the advices I got at the time, I came up with this:
$filename=ExtractFileName($file); // my own function included here
header("Content-Disposition: attachment; filename=\"$filename\"");
It works, I get the dialog, but the white window remain.
What options do I have of closing the window, so I only have the
My email at www.hot.ee has that option, some odd link (/attn/hex-code-
here ) which behaves as I'd like mine too.
What would people around here do?
Re: Save file as attachment
has the target as a new window (i.e <a href="download.php"
target="_blank">) then the new window will open and you will see the
dialog box in front of a empty window (i.e the white you are seeing).
If you make the link stay within the same browser window (i.e <a
href="download.php"> with no target) then it should just open the
dialog box with the current browser window in the background.
It is because you are not sending new HTML for the current browser
window so it has no information for updating so it stays the same.
I think that is what you were looking for but if not then please
clarify a little more.