downloading file

Posted on 2006-04-21
Last Modified: 2013-12-25
i have my website running onApache server. all cgi scripts under cgi-bin
i have a .bin under cgi-bin which is for downloading...
on my home page, i want a link, when the customer clicks this link, he sahould be able to download the .bin and save it on his local machine. how can i achieve this using cgi
Question by:perlperl
    LVL 51

    Expert Comment

    why would you use cgi and not a direct link to your .bin file?

    Author Comment

    the reason i don't want the link is because, first i do some processing, and then i want to the file to be saved on users's local machine
    LVL 51

    Accepted Solution

    your CGI has to read the file and then write it on stdout prepended by a proper HTTP header
    The HTTP header should contain a  Content-Type:  
    Depending on that content type the browser provides a dialog to save the file.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now