View Full Version : remote download script
01-27-2006, 03:02 PM
I'm looking for a script that will allow me to upload files to a remote server from my local pc, as well as being able to upload downloadable files from other websites.
ie. local pc upload path would look like c:/mydocuments/file.exe
and the latter would look like http://www.website.com/downloads/file.exe
Can this be done?
If so, can someone give me a hand since I have no idea how to code.
01-27-2006, 10:09 PM
Do you know if this will allow me to upload files to my server from web links?
I currently have ezUpload Pro 2.2 (http://www.scriptscenter.com/ezupload/) but it doesn't allow me to upload files from other websites, just from my local machine.
That one's easy.
$url = "http://www.crystalinity.net/images/ginger.png";
$dir = "/home/twey/public_html/downloads/";
$rfile = fopen($url, "r");
$lfile = fopen($dir . basename($url), "w");
while(!feof($url)) fwrite($lfile, fread($rfile, 1), 1);
?>Requires URL file-access to be enabled on your server.
12-02-2006, 01:13 AM
while(!feof($rfile)) instead of while(!feof($url))
Apart of this, the code works flawlessly.
Indeed so. A larger buffer size would probably result in increased performance too:
$url = 'http://www.twey.co.uk/images/ginger.png';
$dir = '/home/twey/public_html/downloads/';
$rfile = fopen($url, 'r');
$lfile = fopen($dir . basename($url), 'w');
fwrite($lfile, fread($rfile, BUFSIZ), BUFSIZ);
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.