PHP未上传超过55 kb的文件 [英] PHP not uploading file over 55 kb

查看:40
本文介绍了PHP未上传超过55 kb的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

超过50 KB的文件未上传.我已经检查了php.ini,并且具有以下值

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.

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>

推荐答案

post_max_size必须等于或大于upload_file_size

The post_max_size must be equal or greater than upload_file_size

示例

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

 ; Must be greater than or equal to upload_max_filesize  
 post_max_size = 64M

这篇关于PHP未上传超过55 kb的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆