Welcome to WebmasterWorld Guest from 54.167.252.62

Forum Moderators: not2easy

Message Too Old, No Replies

Download

     
3:09 am on Apr 23, 2004 (gmt 0)

10+ Year Member



I want let user click on a button 'Download' to download a picture (saved in a floder or...)then they will see the download menu as what we always see when we donwload some application from website. Can I do it? Can anyone show me the way? Or where can I get these information, example?
11:08 pm on Apr 25, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can simply put a link to the file on your web page. The problem you will find is that many picture formats are set to default (by a particular user) to open in a program. For instance if I click on a link to test.gif it will open in the Microsoft Picture Viewer and not provide me with the download option.

The way to override this is to zip your image; for example test.zip. Then you you create a link to test.gif and you will be presented with the download window.

PS. You can always right click and choose save as on any link and in effect download the file, but that is not what you asked for.

12:01 am on Apr 26, 2004 (gmt 0)

10+ Year Member



Yes you can do this. In the HTTP protocol there is a feature known as Content-Disposition, it allows the web server to suggest to the browser that the file should be saved instead of being displayed in the browser. It also allows the web server to suggest an alternate filename for the file to be saved as.

See [w3.org...] for technical details about Content-Disposition.

Now the hard part is getting the webserver to include this header. The easiest way to do it is via a script such as PHP, Perl or ASP. If you search for Content-Disposition and one of these scripting language you should come across some examples of how to do it.

12:42 am on Apr 26, 2004 (gmt 0)

10+ Year Member



The short answer is yes. You can force a document to download. We use a PHP script to force a document to download.

Although, we've found it's best to just use a file format that will automatically go to download such as .zip, .pdf, or .doc files. If you force a document to download that would normally just appear in the browser, such as a JPG, people tend not to know how to open it later. And, if they are smart enough to know where to find it after they've downloaded it, and smart enough to know how to select the right program to open it, then they are smart enough to know to right-click on it and save it. IMHO.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month