Hi, i have a problem in code execution in the chapter 4(2nd edition)
the code section: Uploading files
i use the yii 1.1.14
when i uploaded two or more files, files not uploaded.
help me, please.
Hi, i have a problem in code execution in the chapter 4(2nd edition)
the code section: Uploading files
i use the yii 1.1.14
when i uploaded two or more files, files not uploaded.
help me, please.
It could be many things. First of all, check if your php.ini is configured properly:
max_file_uploads should be more or equal to the number of files you’re uploading.
upload_max_filesize should be enough to accept your file.
post_max_size should be more than upload_max_filesize since it will contain both upload and form data.
Thank you for your answer,every thing in my php.ini is correct, when the form is submitted, $files is empty and $model->attributes has one element and $_POST has 3 element, according to your code in the book, this is the result.
There were some changes in CFileValidator and CUploadedFile in recent versions which aren’t covered by the book. I guess it could be one of these:
Thank you again, but nothing changed, i don’t know what to do, i tested all of the cases that I knew, for two or more files, $files is empty.
In your code you have “file” not marked as “unsafe” as I’ve mentioned so you need to change rules() method to the following:
public function rules()
{
return [
['file', 'file', 'types'=>'jpg', 'safe' => false],
];
}
Hi Mr. makarov, every thing that you said is done and my codes is here, thank you for your helping but i did not get result.