Yii图片上传maxsize

时间:2013-01-04 18:29:29

标签: file-upload yii php

$uploadedFile5=CUploadedFile::getInstance($campaign,'image5');    

array('campaign_image,campaign_thumbnail,campaign_imagea,campaign_imageb', 'file','types'=>'jpg, gif, png', 'maxSize' => 5 * 1024 * 1024, 'tooLarge'=>'The file was larger than 5MB. Please upload a smaller file.','allowEmpty'=>true),

大家好。以上是我验证图片上传的规则。但是,它仍然只允许我上传maxsize 2MB的文件,因为我的php中的upload_max_filesize是2mb。

反过来允许我上传大于2MB的图片而不是编辑我的php.ini文件吗?

2 个答案:

答案 0 :(得分:3)

两个单向 s 修改 upload_max_filesize 而不编辑php.ini ......

<击> 在PHP文件中:

ini_set('upload_max_filesize', '10M');

<击> 或者在.htaccess文件中:

php_value upload_max_filesize 10M

答案 1 :(得分:0)

使用

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

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

在您的php.ini中