Saving server side file to local machine with JS
| From: | Skip Evans | Date: | Mon, 27 Jul 2009 03:39:35 +0000 |
| Subject: | Saving server side file to local machine with JS | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-295855@lists.php.net to get a copy of this message | ||
Sorry, I should have been clearer.
When PHP finishes creating the file I need one of the JS alert type windows to appear that says..
"Your file has completed, would you like to save it to your machine?"
Like you get when you download a file.
If I knew the JS code to do this I perhaps could embed it in the PHP at the end of the function that creates the file???
Is that clearer?
Thanks,
Skip
Paul M Foster wrote:
On Sun, Jul 26, 2009 at 09:55:14PM -0500, Skip Evans wrote:Okay, I know I've done this before, but now I'm blanking out. I have code that creates a CSV file, and when it's done I want a JS alert to pop up and let them save the file. Isn't this some kind of alert() type call on the JS side??? I know I've done this before and I've been on Google an hour now!
Not sure I understand your question, but there is a function called
alert() in javascript. It opens a window with your error message in it.
I don't know of a way to trigger this from PHP, since PHP is server-side
and Javascript is client-side. You might be able to have javascript scan
for the existence/closing of the file in question and then alert the
user. Or you could have PHP, when the file is complete, launch a new
page which contains the javascript code to alert the user. Paul-- ==================================== Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison WI 53703 608.250.2720 http://bigskypenguin.com ------------------------------------ Those of you who believe in telekinesis, raise my hand. -- Kurt Vonnegut