PHP not uploading file over 55 kb

2019-09-05 08:20发布

Files more than 50 KB are not uploading. I have checked php.ini and i have following values

post_max_size = 16M (which i have increased from 3 MB but still no luck)
upload_max_filesize = 64M
max_file_uploads = 20

I've tried and read everything, couldn't find a solution, if anyone has gone thru the same problem, please share your experience.

PHP:

if(isset($_FILES["file"]))
{
    if($_FILES["file"]["error"] == 0)
    {
        $uploaded_file_name =  $_FILES["file"]["name"];
        move_uploaded_file($_FILES["file"]['tmp_name'], __DIR__ . "/" . $uploaded_file_name);
        exit;
    }
}

HTML:

<form action="<?php $_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data">
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file"><br>
    <input type="submit" name="submit" value="Submit">
</form>

标签: php file upload
1条回答
等我变得足够好
2楼-- · 2019-09-05 09:00

The post_max_size must be equal or greater than upload_file_size

Example

 ; Maximum allowed size for uploaded files.
 upload_max_filesize = 64M

 ; Must be greater than or equal to upload_max_filesize  
 post_max_size = 64M
查看更多
登录 后发表回答