Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JOD8FY

macrumors 6502a
Original poster
Mar 22, 2004
633
0
United States
Hi,

I want to create a webpage where once somebody visits the page, a file begins to download automatically. How can I do this? I am currently using RapidWeaver 3.5.

Thanks,
JOD8FY
 
You can't make somebody automatically download a file due to (obvious) security issues.

You can, however, give them the download dialog where they accept, save or whatever options their browser has.

You could do this by redirecting to the file. The page will stay the same, but the file download dialog will appear. To do this, place this inside your head tags.
HTML:
<meta http-equiv="refresh" content="1;url=http://www.site.com/file.zip">
Content = time until the new page is loaded.
Url = ...url to file.
 
Be warned, though, most people will be very suspicious of any site that asks them to download something as soon as they get there. You're better off simply linking to it and making it fairly apparent. Besides, do you want people to have to keep seeing that same download pop up every time they visit the site/page?

jW
 
Thanks for the replies. I'm actually selling a piece of software I made on my website. The automatic download page I'm talking about will be the page the customer is redirected to after payment has been processed. I was thinking that this would be better than providing a download link because I could limit the person to just one download. Any other suggestions are greatly appreciated.

Thanks,
JOD8FY
 
I was thinking that this would be better than providing a download link because I could limit the person to just one download.

Not sure I understand. If they reload the page, they'll get it downloaded again anyways, or they can simply bookmark that page and again, they'll get it again. There's better ways of doing this, usually involving some sort of service, though, or better yet you could simply use a serial number system so that no matter how many times they download they can only use it once.

jW
 
Good point, I hadn't thought of that before. I might have to work on implementing some sort of serial number service.

Thanks again for all the help.

JOD8FY
 
It would be relatively easy to limit the number of downloads by giving the user a single-use code that authorizes one download. I could do it in php, but I'm not sure how you're set up.
 
You can't make somebody automatically download a file due to (obvious) security issues.

You can, however, give them the download dialog where they accept, save or whatever options their browser has.

You could do this by redirecting to the file. The page will stay the same, but the file download dialog will appear. To do this, place this inside your head tags.
HTML:
<meta http-equiv="refresh" content="1;url=http://www.site.com/file.zip">
Content = time until the new page is loaded.
Url = ...url to file.


Oh I forgot to mention. Set the time to zero for instant redirection.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.