Difference between #10 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(); ?>
```
[...]
* [Russian Version](http://dbhelp.ru/form-file-upload/page/)
* [Persian Version](http://shgn.ir/%d8%a2%d9%be%d9%84%d9%88%d8%af-%d9%81%d8%a7%db%8c%d9%84-%d8%af%d8%b1-yii/)
 
[You can also check : How to upload image(photo), and path entry in datebase with update functionality](http://www.yiiframework.com/wiki/349/how-to-upload-image-photo-and-path-entry-in-datebase-with-update-functionality/ "How to upload image(photo), and path entry in datebase with update functionality")
66 4
64 followers
Viewed: 516 930 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