我正在使用Amazon EC2服务器与linux实例。在我的业务群组中用户可以上传视频。所以我使用php上传文件。它可以在其他服务器上工作,但不能在亚马逊ec2服务器上工作。当我上传的文件小于1mb时,它可以工作,但如果文件大小大于3mb,它就不能工作。我不知道在哪里设置上传大文件的权限。我能做什么?
这是我的示例代码-
<?php
$fileName = $_FILES["file1"]["name"]; // The file name
$fileTmpLoc = $_FILES["file1"]["tmp_name"]; // File in the PHP tmp folder
$fileType = $_FILES["file1"]["type"]; // The type of file it is
$fileSize = $_FILES["file1"]["size"]; // File size in bytes
$fileErrorMsg = $_FILES["file1"]["error"]; // 0 for false... and 1 for true
if (!$fileTmpLoc) { // if file not chosen
echo "ERROR: Please browse for a file before clicking the upload button.";
exit();
}
if(move_uploaded_file($fileTmpLoc, "test_uploads/$fileName")){
echo "$fileName upload is complete";
} else {
echo "move_uploaded_file function failed";
}
?>
在php.ini
文件中搜索upload_max_filesize
并增加该值。如果我没记错的话,默认是2M。