php - PHP fput无法上传文件
问题描述
我在一个应用程序上上传文件时遇到了一些困难。应用程序正在使用程序 php,它确实很旧,但一切正常。所以问题是,我正在上传一些较小的文件,它说上传不成功,但它已上传。但我不能上传一些更大的文件,例如 10mb。这是检查上传的文件。
else if ($_GET['task']=="uploadfile") {
$serverid = $_POST['id'];
$file['path'] = $_POST['path'];
$file['upload'] = $_FILES['file'];
if ($gpanel->isDemo($_SESSION['clientid'])) {
$_SESSION['notification'] = _ERROR_NOT_AVAILABLE_FOR_DEMO;
header("Location:gp-webftp.php?id={$serverid}&path={$_POST['path']}");
die();
}
if ($gpanel->FTPuploadFile($serverid,$file)) {
$_SESSION['notification'] = "Uspesan upload !";
header("Location:gp-webftp.php?id={$serverid}&path={$_POST['path']}");
} else {
$_SESSION['notification'] = "Neuspesan upload !";
header("Location:gp-webftp.php?id={$serverid}&path={$_POST['path']}");
}
这就是功能
function FTPuploadFile($serverid, $file) {
global $mysql;
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
set_time_limit(0);
ini_set('post_max_size',"100M");
ini_set('upload_max_filesize',"100M");
ini_set('max_input_time', 3000);
ini_set('max_execution_time', 3000);
$serverid = (int)$serverid;
$clientid = $_SESSION['clientid'];
$tmp = $file['upload']['tmp_name'];
$fp = @fopen($tmp, 'r');
$naziv = $file['path']."/".$file['upload']['name'];
$server = mysqli_fetch_array(mysqli_query($mysql->db, "
SELECT `server`.*,`box`.`ip` AS `boxip`
FROM `server`
LEFT JOIN `box`
ON `box`.`boxid`=`server`.`boxid`
WHERE
`server`.`serverid`='$serverid' AND
`server`.`clientid`='$clientid' AND
`server`.`webftp`='on'
"));
if ($server['serverid']=="") $this->serverGreska($serverid, _ERROR_SERVER_NO_WEBFTP_ALLOWED);
$ftp_connection = ftp_connect($server['boxip']);
@ftp_login($ftp_connection, $server['user'], $server['password']);
@ftp_pasv($ftp_connection, true);
ftp_set_option($ftp_connection, FTP_TIMEOUT_SEC, 600000);
ftp_fput($ftp_connection, $naziv, $fp, FTP_BINARY);
// FTP_ASCII , FTP_BINARY
// return true;
//} else {
// return false;
//}
}
可能是什么问题?