Downloading Viewable File

Hello All.

I am developing a Product CD in HTML (viewable only in MS Internet Explorer because of the plug-in I must use).

The situation is that I have set up a page where the user can click on a button and view an Autocad Drawing on the HTML page (thanks to the "Volo View" plug-in by Autodesk).  Below the drawing I would like to have another button labelled "Download This Detail." - meaning that the user could then save the detail that is displayed in front of them to their hard drive.

My question is, how do I accomplish this?  When I use a standard <A HREF="drawing.dwg">Download</A> tag the drawing is simply displayed again in the full browser window (I want the "save file as..." dialog box to come up).

I'm sure that this is possible, but I just don't know how.

Please help
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If the file is supported by a browser, using <a href="drawing.dwg">Download</a> will simply show the item in the browser. If the broswer doesn't support the file type, like zip files, it will attempt to deal with it by opening a "Open/Save" Dialog box.

There are a few ways to handle this.
1) Make the drawing a zip file (or other unsupported file tye) and link the anchor tag to it. This may not be plausible, especially if these drawings are made on-the-fly.
2) Make the link you already have, but instruct the user to "right click" on the link and choose "Save Target As" in order to save the file to their hard drive.
3) Set up an ftp area on your server (if you can), and place the drawings in the ftp area so they may be downloaded. Then use an anchor to link to them like: <a href="">Download this!</a>

I think the best option is number two, but that's just me.

Good luck!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tmagaAuthor Commented:
Thank you for your comments.  I would like to get additional clarification however.

1. Turning all these drawings (there are +/- 2000 of them) into zip format as well as having them in dwg format, would consume WAY to much space on the single CD.

2(a). Is there no more "attractive" way of accomplishing this?  I was hoping to make this truly idiot-proof ("whadda ya mean, the mouse has more than one button?" - true comment from an associate).

2(b). I was hoping to make the link an actual button (like the following code snippet):  Your right-click suggestion will not work with a button.  Is there an equivalent to the right-click when using a button?

 <INPUT type="button"
    value="Download Detail"
    onClick="some magic function that will make this work">

3. As you guessed with your suggestion #3, there will be no server system available.  All that we can assume is that the host computer has MS IE installed (no outside connections, etc.).
Use the Autocad Whip viewer that uses .DWF files instead of .DWG files. You'll still have 2x the number of files but you view the .DWF and download the .DWG.

Your browser simply cannot "know" in advance that this <A HREF...> means to SHOW and this other <A HREF...> means to download when BOTH files have the same extension.

PKZIP is a very efficient way to store .DWG files. They compress pretty well. Although you'll have 2x the files on the CD, the .ZIP's will take less space than the original .DWG's.

In either case the file conversion can be automated with the help of a little BASIC code and a batch or two.

For example, you can easily write a piece of BASIC that, given a list of .DWG files (from a DOS DIR command...), drives AutoCad and makes it load the .DWG, run the DWFOUT command, and repeat for each one.

Writing a similar routine to use the DOS version of PKZIP to create one zip file for each .DWG would also not be hard.

The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

tmagaAuthor Commented:
Thanks for your comment.

The Autodesk Whip! plug-in is used to view DWG or DXF files with Netscape Navigator.  I'm using the equivalent Autodesk plug-in called Volo View (it's for MS Internet Explorer).  The Volo View plug-in will let me do several things that the Whip! plug-in won't).

In any case, I won't need to have duplicate files on the CD because the plug-in will display the DWG files fine.

So, in answer to my original question, there is no "idiot-proof" way of having a button for the user to push that will download the displayed drawing?

Please let me know.
Nope. The HTML syntax for "download" is the same as "Show" If the system understands the .DWG extension and can find a plug in for it, then the file is handed off to the plugin for display. If the system *doesn't* understand the extension, THEN it asks "what to do?" with the file, one option is "Download". Since the file extension is what is driving this behaviour, the ONLY choice is to have TWO extensions available. One to show, one to download. Since you're locked into .DWG for SHOW, you're going to have to come up with something else (.ZIP?) for download.

For reference, the answer to the problem was using file:// instead of http:// in the anchor tag.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.