使用PHP上传较大的文件失败

I'm trying to upload a file with the size of e.g. 244 KB via POST request with PHP but it causes a 403 Forbidden error. When I upload a small file (e.g. 3 B) it works fine.

I've made sure my PHP.ini is configured to support bigger files as seen below in the CPanel screenshot:

我的PHP脚本如下:

<?php

$filename = $_GET['filename'];
$fileData = file_get_contents('php://input');
file_put_contents($filename, $fileData);

错误处理,为清楚起见已将其删除。

Adding a user agent to the POST request does not help.

较大的文件被拒绝上传的原因可能是什么?

评论