因为要往服务器上传个比较大的文件,用FTP软件太慢了。
在网上找到如下代码,例如下载:http://dl_dir.qq.com/qqfile/qd/QQ2012Beta3_QQProtect2.8.exe
但下不完整,请问如何修改,上G的大文件都有,还有其它办法么?<form method="post">
<input name="url" size="50" />
<input name="submit" type="submit" />
</form>
<?php
// maximum execution time in seconds
set_time_limit (24 * 60 * 60);
if (!isset($_POST['submit'])) die();
// folder to save downloaded files to. must end with slash
$destination_folder = 'temp/';
$url = $_POST['url'];
$newfname = $destination_folder . basename($url);
$file = fopen ($url, "rb");
if ($file) {
$newf = fopen ($newfname, "wb");
if ($newf)
while(!feof($file)) {
fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
}
}
if ($file) {
fclose($file);
}
if ($newf) {
fclose($newf);
}
?>
在网上找到如下代码,例如下载:http://dl_dir.qq.com/qqfile/qd/QQ2012Beta3_QQProtect2.8.exe
但下不完整,请问如何修改,上G的大文件都有,还有其它办法么?<form method="post">
<input name="url" size="50" />
<input name="submit" type="submit" />
</form>
<?php
// maximum execution time in seconds
set_time_limit (24 * 60 * 60);
if (!isset($_POST['submit'])) die();
// folder to save downloaded files to. must end with slash
$destination_folder = 'temp/';
$url = $_POST['url'];
$newfname = $destination_folder . basename($url);
$file = fopen ($url, "rb");
if ($file) {
$newf = fopen ($newfname, "wb");
if ($newf)
while(!feof($file)) {
fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
}
}
if ($file) {
fclose($file);
}
if ($newf) {
fclose($newf);
}
?>
这个还用考虑吗?服务器对服务器之间的传输不应该慢
如果是客户端 对服务器端的FTP慢,你用什么方法他都是慢。一个折中的方法,如果文件只有本地有,那么传到QQEMAIL中转