【问题标题】:File upload not working more than 10mb in AWS Linux 2 server?文件上传在 AWS Linux 2 服务器中不能超过 10mb?
【发布时间】:2019-10-03 19:14:27
【问题描述】:

当我尝试上传超过 10mb 的视频时,服务器显示错误 502 我也更改了 php.ini 文件,phpinfo 也反映了更改

    post_max_size 40M
    upload_max_filesize 35M
    max_execution_time 1200
    max_input_time 
    <?php
    error_reporting(E_ALL);
    $target_dir = "uploads/";
    $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

    if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
    echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
        } else {
            echo "Sorry, there was an error uploading your file.";
        }

    ?>

    <!DOCTYPE html>
    <html>
    <body>
    <form action="upload.php" method="post" enctype="multipart/form-data">
        Select image to upload:
        <input type="file" name="fileToUpload" id="fileToUpload">
        <input type="submit" value="Upload Image" name="submit">
    </form>

    </body>
    </html>

【问题讨论】:

  • 你确定是文件大小的问题吗?可能你的请求太长了(比 Nginx 超时时间长)
  • 不,当我上传 5mb 的视频时,它在上传 10mb 时工作正常,它的节目“当前无法处理此请求。HTTP 错误 502”,我正在使用“amzn2-ami-hvm”服务器

标签: php amazon-ec2


【解决方案1】:

您使用 API 网关吗?它对有效载荷大小有 10Mb 的限制。请看:

https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html

【讨论】:

  • 不,我没有使用 API 网关。
猜你喜欢
  • 2019-03-26
  • 1970-01-01
  • 2015-02-08
  • 2020-09-25
  • 2020-06-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-10
相关资源
最近更新 更多