Jump to content
Sign in to follow this  
crazyswede

download program

Recommended Posts

Okay, I have several programs I wrote in ASP (classic)/JavaScript that I run on my website, feeding from and  storing to MDB and txt files stored on the server. I Periodically want to download and save these files on my computer.  Right now, I have to fire-up my big, elaborate FTP system - a long and lengthy process. I was wondering if (and how) I could write a program so I could just click on a button on my screen and download the file? Just point me in the right direction and I will figure it out.

Share this post


Link to post
Share on other sites

The general method is to send the correct headers to tell the browser what kind of file it is, then read the file from disk and output the contents to the browser.

Share this post


Link to post
Share on other sites

<%@ Language=JavaScript %>

<HTML>

<HEAD>

  1. Here, I’m guessing that “href=” section below refers to where the program goes to get the file to download from the server.

  2. The “download=” section  I’m guessing Is where I tell the program where to  download that file on my computer.

  3. I'm not entirely sure what the “img src=” section is for but we're not working with images so  I am guessing I can leave in out

<a href="http://ccs2468.com/books/books09.mdb" download="c:books09.xxx"> </a>

<! img src="/images/myw3schoolsimage.jpg" alt="W3Schools">

</a>

4) I tried this too with no luck.

<a href="/books/books09.mdb" download="c:books09.xxx"> </a>

Done <-- I put this in just To show me that the program has run. 

But I run the program and then check on the computer, and nothing has been downloaded. what am I doing wrong?

</BODY>

</HTML>

Edited by crazyswede
clarify

Share this post


Link to post
Share on other sites

That's not valid HTML code, <a> tags and <img> tags don't go in the head section of the page.  I'm not aware of any tag having a "download" attribute, either.

If those files are already reachable on the web server then you just type the URL to the file in a browser to download it.  I was assuming the files are not available in the web server root.  If they are not, then you need to output the correct HTTP headers, and then send the contents of the file.  HTTP headers have nothing to do with the head section inside an HTML document if you got confused about that.  You use ASP or another server-side language to send the response headers.  They tell the browser that you're sending a file of a certain type and size, what the name is, etc.  They result in the browser showing the save/open dialog box.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...