Question:
Make your site host a download?
2010-03-13 11:32:23 UTC
I don't know exactly how to make the question. Anyway, there are sites that have a product, you click download now, and it either brings you to a blank page, or no page comes, and the product just starts downloading. How do you do that? Thanks in advance.
Five answers:
?
2010-03-13 11:44:25 UTC
Just link to the file:



file



just like you'd put a link to another page:



new page



In both cases, the browser downloads the link -- it's just that, if it's another page, the browser knows to go ahead and display it automatically without a download dialog.



As an example, you can look at a page on my site [1]. You can view the page source and compare how the files and how the "Back to ____...." links work -- you'll see that the syntax is the same, and it's just what the browser does with the different file types that's different.
Anza Power
2010-03-13 11:47:27 UTC
You'll also need some place to host that file, free web hosting sites don't allow big files to get uploaded there, you'll need to pay for a membership at the site or at sites like megaupload.com and sendspace.com , then just do the
luker
2010-03-13 11:44:24 UTC
You do this by having a file up on your web server, and then linking directly to that file using an anchor:



This is a link to a web site



This is a link to a file



The link's path needs to be accurate from the web page to the file on your web server. The blank page opening up is simply the browser handling this type of link (and each browser does it a little differently).
2016-03-02 01:47:51 UTC
why not try torrents or megaupload or try searching on utube? i have downloaded following games using torrents : motorm4x some psp games crysis gta san andreas
radgeofrey mission
2010-03-13 11:51:05 UTC
for the download link you have to put target="_blank" in your webpage/html to open new tab/window



Download Here





And to be sure that the file will download via octet-stream, to sure that save-as dialog will open (because image, text or html are mostly opened via browser after click, but this time we need to save the image, and not to open it via browser)



header("Content-Type: application/octet-stream; ");

header("Content-Transfer-Encoding: binary");

header("Content-Length: " . filesize('filename.ext') ."; ");

header("filename=\"filename.ext\"; ");

readfile("filename.ext");



This is for PHP, but for ASP and other server side scripting, you can use same logic because they both use HTTP Headers.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...