0

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.

2
  • Whats you model's class? and where is it located? Commented Nov 24, 2011 at 15:34
  • Do you Yii::import() the Upload class? Commented Nov 24, 2011 at 22:03

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.