View Full Version : Creating "Save as..." Popup in Javascript


Pyrrhonist
03-12-2004, 11:30 AM
i have a question, okey maybe it's not directly relevant with PHP.

i have a webpage that contains .doc and .txt files, of course when you click any icon with left mouse click then windows opening the .doc or .txt files.

can i propmt the user with "save target as" dialog box when he/she left click to icons with java script? i dont want to tell them that hey, please right click and save (and i dont wanna zip the files).

How can i do this? it is possible with java (xor with PHP help)?

relaxzoolander
12-20-2004, 02:36 PM
hey bob!

heres the asp solution...its a nifty one.
see the bottom of this thread:
frontpagewebmaster.com/m-229698/tm.htm

working solution here:
wichitaswimclub.org/results/sSort.asp

hope it helps a bit.

[m]

Andraw
01-14-2005, 06:05 PM
Hi, relaxzoonlander,

your link above is what I just want, I am headache two days for it, but from the link, I cann't see how they do it, can you give the source codes to show how to do it? I create a word file in server side in ASP, I want the client can save it at the client side, but when user open it, either there is nothing, or is binary file, what's wrong?

Give me some instructions! tks!!!!!!!!!!

Andraw

relaxzoolander
01-14-2005, 10:59 PM
[QUOTE=Andraw]Hi, relaxzoonlander,
your link above is .............
Andraw[/QUOTE]
when you get my name right....i may think about your request.
.

Andraw
01-15-2005, 04:48 PM
relaxzoolander,

Sorry about that, please think about my problem as soon as possible. Urgent??

Andraw.

dilligaf
01-15-2005, 05:24 PM
You can call me Zoonlander, just don't remind me of my world cup of hockey statement (smiley here). The code is available in the thread that RelaxZoolander referenced (frontpagewebmaster.com/m-229698/tm.htm) in the last post.

Just click "View Code" (and that is pretty trick, thanks)

Andraw
01-16-2005, 07:35 AM
relaxzoolander,
The little boy above is so dorable.
Thanks for the link for source codes . Is the file is word file with picture/header/footer, when user download it, they will be lost? I test one using almost the same code, only the content in the main page appear, the header is lost, is it normal?

dilligaf
01-16-2005, 07:44 AM
I'm actually Dilligaf but thanks for the compliment. So the file is downloading and not opening up the program on your machine?

I'm a Word newb, but I'd guess it's how the program accesses images NEBody else? When you send images in a word file do you have to send the images like you would in html?

Andraw
01-16-2005, 07:55 AM
Hi, All,
I have another question. I create a page with two frames,
the lower one with buttons "Back" "Update Report", "Download";
the upper frame display the dynamically generated report.
when user click the "Download" button, the report will be download by user. What's the best way to do it in ASP. If possible, I dont want to save the report file in the server side. I think about two ways to do it:
1: display the report generated by html on the upper frame, if user click the "download" button, open a new window, dynamic generate a word report ( "report.doc") based on word template, force the user to save it. when user close the new created window, remove the "report.doc" file from server. -------- not a good option, I have to double work.
2: the upper frame also display the "report.doc", this way I don't have to do the double work, but how can I make sure the file will be deleted. when user close the download window, I cann't delete it, maybe the file is displayed in the upper frame. when the window with frames is closed, I still cann't delete it, because the use didn't close the download window. ------ how to deal this problem.

May be the above ways are not good options for you, do you have any better way to solve it. Remember the report is dynamic generated according to data in database.

Waiting for your reply to make my decision.

Andraw

Andraw
01-16-2005, 08:03 AM
Dilligaf,

"When you send images in a word file do you have to send the images like you would in html?"----------------- what this mean????
When download a file, I open the word file, put all the contents in ADODB.Stream, the use Response.Binary to write the stream to screen, the images are already in the word file, how can i put them in html?

Andraw

dilligaf
01-16-2005, 08:16 AM
I thought you were saying that when your word document downloaded the images were not included. I don't know $^&* about Word so I was using sending HTML as a reference.

Flip
09-15-2005, 12:31 AM
Could the same thing be done with a file on another server ?
With a link, instead of a file an the same server the page is on ?