|
| |
|
|
chadb
Posts: 487 From: Kansas Status: offline
|
Making Hyperlink file prompt for Save As - 11/6/2003 16:09:39
I have a hyperlink that is a Power Point file, can I have the hyperlink prompt the user (make them) save the file?? Thanks
|
|
|
|
Phunky
Posts: 35 Joined: 11/6/2003 Status: offline
|
RE: Making Hyperlink file prompt for Save As - 11/6/2003 16:28:06
i am not sure if this will help, but it may do it automatically... i know i added a PDF file that I wanted the same thing to happen and it worked... all i did was put the PDF in the same folder as my website and linked to it... this may or may not work for your .ppt file...
|
|
|
|
DarlingBri
Posts: 3123 From: Left of Centre, Cork, Ireland Status: offline
|
RE: Making Hyperlink file prompt for Save As - 11/6/2003 21:50:49
No, you can't. On a Windows machine, the download will auto-launch the associated application, in this case Power Point. So, you can either tell people to right-click and choose Save As, or put your PPT presentation into a ZIP file to avoid the auto-launch.
_____________________________
--Bri Bartlet for President 2008 Get a taste of religion. Lick a witch.
|
|
|
|
roryknowles
Posts: 23 Joined: 11/9/2003 Status: offline
|
RE: Making Hyperlink file prompt for Save As - 11/9/2003 22:20:07
I do it like this for my web site, for PDF and Text Files. Post here or email me if you have any questions. If you get an error in the file you downloaded, then your server doesnt support ADODB.Stream. To see an example go here go here, http://www.knowlesrealty.com/listing.asp?ref=417 , and click on the PDF or TEXT icons. (PS. not advertising, just giving an example) -------GENERAL INFO -------------- The variable ref on my site is the ID of the listing we use to identify the particular file. You can optionally make it do it manually. I use the variable 'fn' so the user sees a name of the file instead of just the web site or file name they are downloading. ------THE DOWNLOAD LINK------------ <a href="javascript:download('TXT','342')"> <img src="images/text.gif" align="absbottom" border="0" alt="Download as TEXT file"></a> -------THE JAVASCRIPT FUNCTION------- The following javascript is placed on the page you have the download link on. <script language="JavaScript"> <!-- function download(type, ref) { if(confirm("This file is copyright (c) 2003 My Company. Please do not make any modifications, changes, and alterations to its contents. By downloading the file you accept these terms.")) { location.href = "http://www.mycompany.com/dl.asp?dl="+type+"&ref="+ref+"&fn=[MyCompany-Ref"+ref+"."+type+"]"; } } //--></script> -----THE ASP PAGE ----------- The following is the ASP page called dl.asp which downloads the file. In the filename area below 'dl' is the extension of the file type passed from the download link. The actual Filename is the location of the file, name etc. to download. In this example the download files are located in the same folder, and they are in folders named by the 'ref' numbers EXAMPLE FOLDER VIEW: 342 - Folder dl.asp - download asp page SCRIPT: dl.asp (You will need to test this by downloading a file and opening it, to see if it contains an error or not. If it contains an error, the server your site is hosted on does not have the ADODB.Stream object installed, most do as far as I know, and this is the only way I could get this to work properly, after trying a couple other methods) <% 'On Error Resume Next Dim Stream Dim Contents Dim FileName Dim Name FileName = "downloads\myfile.txt" 'LOCATION WITH NAME Name = "myfile.txt" ' NAME AND EXTENSION TO SAVE IT AS Response.ContentType = "application/force-download" Response.AddHeader "content-disposition", "attachment; filename=" & Name Set Stream = server.CreateObject("ADODB.Stream") Stream.Open Stream.LoadFromFile Server.MapPath(FileName) Contents = Stream.ReadText Response.BinaryWrite Contents Stream.Close Contents = "" Set Stream = Nothing %>
< Message edited by roryknowles -- 11/9/2003 10:24:06 PM >
|
|
|
|
ssudhakar
Posts: 1 Joined: 11/11/2007 Status: offline
|
RE: Making Hyperlink file prompt for Save As - 11/12/2007 7:53:51
Can i get the JSP compatible code for the above. I need help similar to that for the jsp page which have PDF hyperlink user can have option to "save as" or open the document. thanks
|
|
|
|
d a v e
Posts: 4177 Joined: 7/24/2002 From: England (but live in Finland now) Status: offline
|
RE: Making Hyperlink file prompt for Save As - 11/12/2007 16:21:16
if the user right clicks they get this option built into their browser anyway.
_____________________________
David Prescott Gekko web design
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|