duandou2763 2015-08-28 09:03
浏览 119

Yii2 max filesize

My php.ini:

upload_max_filesize = 10M

My model:

public function rules()
{
    return [
        [['user_id', 'name', 'description', 'image'], 'required'],
        [['user_id', 'is_active'], 'integer'],
        [['date_of_creation'], 'safe'],
        [['name'], 'string', 'max' => 256],
        [['description'], 'string', 'max' => 512],
        [['players', 'level', 'time', 'best_time', 'fear', 'stress', 'teamwork', 'fun'], 'string', 'max' => 128],
        ['image', 'image', 'extensions' => 'jpg, gif, png, jpeg', 'maxSize' => 1024*1024*10, 'minWidth' => 100, 'minHeight' => 100],
    ];
}

My error:

Array ( [image] => Array ( [0] => The file "original_girl.jpg" is too big. Its size cannot exceed 2,097,152 bytes. ) )

Can enybody say what's wrong? In php.ini and in my model's rules I use 10 MB.

  • 写回答

3条回答 默认 最新

  • dsxpt62448 2015-08-28 09:11
    关注

    Did you set Post Max Size too?

    post_max_size=10M
    

    You also need to set post_max_size in php.ini

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度