English 中文(简体)
利用PHP下载遥控文档(2GB)
原标题:Download a remote file (2GB) using PHP

I have a large file (2GB) and I want to download it to server A from server B with PHP.

我尝试过普惠制和民盟,但没有成功。 即便我确定“时间”为0值的限制,它还是回过了一次技术评估的结果。

Here s my code:

<?php

set_time_limit(0)

$local_file =  file.zip ;
$server_file =  /www/file.zip ;

$conn_id = ftp_connect("ftp.webmashing.com");

$login_result = ftp_login($conn_id, "USERNAME", "PASSWORD");

if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) {
echo "Successfully written to $local_file
";
} else {
echo "There was a problem
";
}

ftp_close($conn_id);

?>
问题回答

如果您在文件上排出时间,请看http://php.net/manual/en/Function.ftp-pasv.php>rel=“nofollow”ftp_pasv()

bool ftp_pasv ( resource $ftp_stream , bool $pasv )

在你的案件中,尝试:

$conn_id = ftp_connect("ftp.webmashing.com");

$login_result = ftp_login($conn_id, "USERNAME", "PASSWORD");

ftp_pasv($conn_id, true);

在接到要求后,将“时限”改为“零”。 换言之,如果停下来时间为30秒,25秒为文字执行,则如规定时间为20(20),则文字在排出时间之前总共为45秒。 请检查在php中发出的“最高执行——时间”指令。

如果您能够(取决于您的实验室档案的执行情况),你可以改变“最高标准”——时间更长。

现在,我要做的是(如果你有权利的话,就是要按照从营地档案中发出的指令行事。 指挥线将在具体档案中写明结果,而你们都必须做的是检查该档案的内容。

一旦得出结果(即“0”),你就可以做你想要的。

在前端,获得下载状态的麻风 the可能同样有用!

但一如既往,这取决于你能否指挥炮兵。





相关问题
How to upload and download file from a server using C#

I am developing a webpage in that the user can download their Resume for Edit. So I have a link to download the article. I use the following code for download. DataTable dt = user.getUserDetails(2); ...

Detecting PDF Download

I have recently added functionality for generating pdf reports to a web application. However the reports can be quite large and take some time to show the pdf download dialog. I want to show a spinner ...

Writing file to users giving sporadic error in IE

I have a very interesting issue with only specific IE implementations. I have an ASPX page that is used to write files down to the user, as part of the process the page uses the following code to ...

PHP - List of Excel files to download from Intranet Site?

I have a intranet site running PHP 5 that needs to list a folder containing only Excel files. Ideally the user needs to be able to input some search criteria (ie date) and the files would be filtered ...

Determine total size of SVN directory/trunk

Is there a way to count/calculate the total size of a svn directory if you were to checkout a revision? I have limited internet downloads so I need to know how big something is before I go and ...

Scala and html: download an image (*.jpg, etc) to Hard drive

I ve got a Scala program that downloads and parses html. I got the links to the image files form the html, Now I need to transfer those images to my hard drive. I m wondering what the best Scala ...

Downloading file with wxHTTP?

Im really stumped. Im using the wxHTTP class in wxWidgets to try and download two files. The first request succeeds but the second one fails when wxHTTP->GetInputStream is called. Between downloads, ...

热门标签