DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: File Download

  1. #1
    Join Date
    Jul 2006
    Posts
    3

    File Download

    Hi,
    I need to download ".bat" file on click of an image.
    The code is :
    <script>
    function downloadBatchFile() {
    window.open('http://myserver/download.bat');
    }
    </script>
    .....
    <img src="FileDownload.gif" onclick="downloadBatchFile();"/>

    With this code, the file content are displayed in the new window. No download/save window is shown.
    I tried doing the same with the help of <a href ..> tag. but the output is same.
    Can any one help me on that.

    (If I replace .bat file with .zip file it shows me the Save window, and the zip file can be downloaded);

    Thanks,
    Nilesh

  2. #2
    Join Date
    Nov 2006
    Posts
    24
    Please research "mime types". If the user's browser is configured to handle a certain mime type a certain way, then that's what is going to happen. If you want them to always download a file, then give them instructions on how to do that (usually, by right-clicking the link). Or, give the file a different mime-type and/or extension, and inform the user how to rename the file after it's been downloaded.

Similar Threads

  1. File Download
    By mikester20 in forum ASP.NET
    Replies: 0
    Last Post: 10-30-2006, 06:25 PM
  2. Download file from my Web Page
    By egrave in forum Java
    Replies: 0
    Last Post: 10-21-2006, 11:51 AM
  3. Replies: 0
    Last Post: 09-25-2006, 11:46 AM
  4. Replies: 0
    Last Post: 11-22-2002, 01:43 PM
  5. Replies: 0
    Last Post: 01-12-2001, 12:27 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center