Difference between #12 and #14 of
How to upload a file using a model

Changes

Title unchanged

How to upload a file using a model

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

File upload

Content changed

[...]
// ... other attributes

public function rules()
{
return array(
array('image', 'file', 'types'=>'jpg, gif, png'
, 'safe' => false),
);
}
[...]
echo $form->error($model, 'image');
// ...
echo CHtml::submitButton('Submit');
 
$this->endWidget();
```
[...]
<?php echo CHtml::activeFileField($model, 'image'); ?>
...
<?php echo CHtml::submitButton('Submit'); ?>
 
<?php echo CHtml::endForm(); ?>
```

### Links

* [Russian Version](http://dbhelp.ru/form-file-upload/page/)
[...]
66 4
64 followers
Viewed: 517 362 times
Version: 1.1
Category: Tutorials
Written by: qiang
Last updated by: samdark
Created on: Feb 4, 2009
Last updated: 8 years ago
Update Article

Revisions

View all history