怎莫用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