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.
假设我找到了一个大小为400 MB的文件,我想在我的服务器上托管它。我使用的正常方法是将文件下载到我的电脑然后上传到我的服务器,但有一个脚本或方法直接传输和托管文件而不下载它。
4 个解决方案
#1
1
As long as you have PHP use:
只要您使用PHP:
<?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);
?>
#2
1
wget from your server.
wget来自你的服务器。
#3
0
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.
如果您可以远程访问服务器,则只需从服务器中导航到包含下载的网页,然后将其直接保存到服务器。
#4
0
I think FTP protocol supports server to server transfer.
我认为FTP协议支持服务器到服务器的传输。
#1
1
As long as you have PHP use:
只要您使用PHP:
<?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);
?>
#2
1
wget from your server.
wget来自你的服务器。
#3
0
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.
如果您可以远程访问服务器,则只需从服务器中导航到包含下载的网页,然后将其直接保存到服务器。
#4
0
I think FTP protocol supports server to server transfer.
我认为FTP协议支持服务器到服务器的传输。