Yii, How To Save Path Upload File To Database?


I need help. How i can save a path upload file to database. I have table "files" and inside have tree record, ID, PATH, TASK_ID.

when I am creating task i can upload file in path : "C:/some path/files". But i need save this path to database -> "files" record -> path .

 $model->path="ASSIGN VALUE FOR PATH"

in this way you can save a path for uploaded file in database.

But please make sure, file is uploaded and you got the uploaded path.;)

OK thx! now i need download this path to link:

<td><?php echo CHtml::link("download file", array(Yii::app()->baseUrl . '/protected/upload/' . $data->id . '/' . $task->id . '/')); ?></td>

This is path written. I need path from database about the Task ID .

In Files Table i have path, task id and id [AI].

how do it?