prompt for save or open a pdf or doc file
i have an application where there are .doc,.pdf,.zip files attached and have links to those files..
but when i click on those links they are straight away opened in the browser window.. but i want the browser to prompt whether to open or save to a target in the local machine..
how can i do it.. by the way i cant zip all the files so that anyhow it'l ask for save or open the file..
if anyone has an idea of what to do for this pls reply..
waiting for your prompt reply..
Thanx in advance..
It is in the configuration of the browser. The internet options or preferences (depending on which browser you are using) has a list file types that can be handled by the plugins installed in the browser or by the browser itself. Anything that matches that list will be handled within the browser, anything that doesn't will be offered for download.
For Internet Explorer you need to go to "Tools", "Internet Options", "Programs", "Manage Add-ons" to see and edit the list.
Last edited by felgall; 01-02-2007 at 05:10 AM.
Thanx for your prompt reply felgall
i think you are correct but the client wants the every user who uses this site to be able to prompt for that action whether to open or save..
cant we do anything abt it from our side to make it happen in the client's desired way??
thanx again for replying so soon..
and by the way in my IE - "Tools", "Internet Options", "Programs" doesnt have anything called "Panage Add-ons"..
if you can guide me how to do it through a script, that would be so great.. so that all the users who use the site can priviledge the facility..
That should be Manage Add Ons and no you cannot dictate how individuals download files, some set their browsers to automatically download to a specific folder or to prompt to save to a specific folder...change your browser setting to prompt to save then tell your client that you fixed it
Originally Posted by rukrlf
but the prob is he watching it in some other machine..
I had some success using window.location to prompt people to download or save pdf's or zips etc.
If you can, send it with a MIME type of application/octet-stream, then in most cases the browser should go for a save-as dialogue.
Originally Posted by rukrlf
Disclaimer. (1) Whilst I will help you sometimes, if I feel like it, and my advice in relation to your actual question will be of good quality: my posts are to be taken with a pinch of salt. I will be sarcastic, deploy irony and include obscure cultural references for my own amusement without warning.
(2) You will gain nothing from complaining, and if you try to argue with me then you will not win. No matter how noble your battle seems, I am still better than you, don't be an hero.
could you pls tell me how can i do it.. where should i change the code??
Originally Posted by the tree
thanks so much in advance..
Most people don't like it when you try to override their choice on how they have configured their browser to work and so if they have configured it to be able to view particular document types in their browser they will get annoyed if you try to force a download instead.
To set the MIME type you simply specify the appropriate value in a header record for the page. How you do this depends on which server side scripting language you are using to generate the page. It can't be done with plain HTML.
Actually felgall i'm not forcing the user to download the doc or pdf, i just want to prompt the user to choose either open it on the browser then and there or else if he wants he should have the facility of saving it to the computer as well.. so i thought it is more user friendly than just opening up the document then and there.. b'coz there can be users with slow connections and if it try to open quite a big file then the browser will get stuck wouldnt it??, by providing both the options i think it is much better so that he/she can choose what is the most appropriate action..
Originally Posted by felgall
actually what happens when the the plugin is not there is poping up a dialog box asking whether to open or save isnt it?? what i want to do is exactly the same..(rather my client wants)..
im using ASP as the server side language.. so how can i accomplish it with ASP??
all your thaughts were very useful and i highly appriciate your concern..
To do it with ASP you could just write out a header setting Content-Disposition: to attachment rather than inline which instructs the browser to offer the file for download.
Just remember that the header has to be written before any of the actual page content.
Response.AddHeader "Content-Disposition", "attachment"
sorry for troubling you this much sir..
but how can i write out the header setting to the attachment?? coz when i wrote it on the top of the page, it asks to download the '.asp' page..
my '.doc' , '.pdf' files are straight away attached to the "<a href>" links..
pls be kind enough to clear my self up..
i know i'v been a real nuisance.. pls hold ur nerves for this question..
You can't do it from a straight link.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)