Reputation:
I own a website and I wonder if there is a script that get files for me from other links on the net a load it to my server.
Suppose I found a file with a size of 400 mb, I want to host it on my server. The normal way I used is to download the file to my pc then upload it to my server but is there a script or a way to transfer and host the file directly without downloading it.
Upvotes: 0
Views: 221
Reputation: 90851
As long as you have PHP use:
<?php
$remotefh = fopen('http://domain.tld/path/to/file.ext', 'r');
$localfh = fopen('local/file.ext', 'w');
while(!feof($remotefh))
{
fwrite($localfh, fread($remotefh, '4096'));
}
fclose($remotefh);
fclose($localfh);
?>
Upvotes: 1
Reputation: 77
If you can remote into your server you could just navigate to the web page containing your download from within the server and save it directly to the server that way.
Upvotes: 0