Shahid Karimi
Shahid Karimi

Reputation: 4357

yii file upload Exception

When I upload files in Yii using the following code it generates an error.

$file=CUploadedFile::getInstance($model,'file');

and the error goes here. [YiiBase::include(Upload.php) [function.YiiBase-include]: failed to open stream: No such file or directory]

I think a minor thing is being missed by my while configuring Yii. Any kind of help is appreciated.

Upvotes: 0

Views: 971

Answers (1)

NadaNK
NadaNK

Reputation: 802

did you specify the enctype in your form ? i.e for example:

CHtml::beginForm('', 'post', array('enctype' => 'multipart/form-data'));

if it's not specified the file won't be uploaded.

Upvotes: 1

Related Questions