mannaraja
10-25-2009, 09:49 AM
Please help me my friend,
URL Download script- i need a script which download files using URL from other site to our server directly..
djr33
10-25-2009, 07:34 PM
Why? You can save a link to your computer by choosing right click, save as. If you decide to route the file through your server, it will be slower (downloading twice) and they will still have to right click, save as. It will waste your bandwidth and be a hassle for the user.
If you are attempting to make a proxy site, that might be useful, but still would waste your bandwidth. Also be sure you have permission from the sites you are getting files from, unless you are letting the user choose while files he wants.
Anyway, here's the basic way to do it:
http://www.php.net/manual/en/function.fread.php
Use a function like that (there are a few ways) to get the contents of the file.
Use fwrite() to save it to your server.
Then just let the user have a link to that file.
Alternatively you could actually grab the contents of the file (fread, etc.) and directly output it including headers so that it isn't a webpage served by php, but instead the actual file. But with big files this would be a huge delay (the entire transfer time to your server).
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.