Behavior to save Files

This behavior automate the tedius procedure to save the file in to the disk.

public function behaviors()


        return array('saveFileBehavior' => array('class' => 'SaveFileBehavior',

                                                 'campo' => 'myTableField', // field in table which stores the file name




<div class="simple">

	<?php echo CHtml::activeLabelEx($model, 'myTableField'); ?>

	<?php echo CHtml::activeFileField($model, 'myTableField', array('size' => 40)); ?>


What does this Behavior?

It saves the file automactly here:


It’s very simple and it works.

You may customize it, i don’t know if it’ll work for everyone.

Attachments are in the post, just download them here: