标题:怎莫用php在局域网内向服务器上传大文件呢?(10M左右)
只看楼主
black_white
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2004-11-25
 问题点数:0 回复次数:0 
怎莫用php在局域网内向服务器上传大文件呢?(10M左右)
--------------------------------------------------------------------------------
<?php
set_time_limit(100);
$username="admin";
$password="admin";
$server="localhost";
?>
<form enctype="multipart/form-data" action=ftp.php method=post>
<input type=hidden name=username value=<? Echo $username; ?>>
<input type=hidden name=password value=<? Echo $password; ?>>
<input type=hidden name=server value=<? Echo $server; ?>>
<input type=hidden name=action value=1>
<table><tr><td>上传文件选择<input type=file name=upfile></td></tr>
<tr><td><input type=submit name=submit value=上传></td></tr></table>
</form>

--------------------------------------------------------------------------------
<?php
set_time_limit(100);
function connect()
{
echo "1";
global $server, $username, $password;
$conn = ftp_connect($server);
echo "2";
ftp_login($conn, $username, $password);
echo "3";
return $conn;
echo "4";
}
$result = connect();
echo "5";
if ($action ==1)
{
echo "6";
$res_code = ftp_put($result, $upfile_name, $upfile, FTP_BINARY);
echo "7";
if ($res_code == 1)
{
echo "8";
echo "上传成功!";
}else{
echo "9";
echo "上传错误!";
}
echo "10";
ftp_quit($result);
echo "11";
}
echo "12";
?>

--------------------------------------------------------------------------------
上传小文件时没问题 结果显示:1/2/3/5/6/7/8/上传成功!/10/11/12

但在上传大文件时为什莫不成功
结果显示:
1/2
Warning: ftp_login() [function.ftp-login]: Not logged in. in ******\ftp.php on line 9
/3/5/12

搜索更多相关主题的帖子: 局域网 服务器 php hidden 
2004-11-26 18:31



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-8438-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.159133 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved