PHP not uploading file over 55 kb

半世苍凉 提交于 2019-12-11 22:02:53

问题


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>

回答1:


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


来源:https://stackoverflow.com/questions/24839741/php-not-uploading-file-over-55-kb

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!