Bman900
(Balint2005)
November 17, 2011, 6:26pm
1
So am trying to save a file twice but in different location. The first time it works fine but the second time I call the saveAs() function, it does not save.
Here is part of my code:
$model->avatar->saveAs(Yii::app()->basePath . '/../images/avatars/temp/' . $model->id . '.' . $extension);
$model->avatar->saveAs(Yii::app()->basePath . '/../images/avatars/' . $model->id . '.' . $extension);
kokomo
(Mwerlberger85)
November 17, 2011, 6:40pm
2
You have to set the second parameter $deleteTempFile of the saveAs method to FALSE . Default value is true.
$model->avatar->saveAs(Yii::app()->basePath . '/../images/avatars/temp/' . $model->id . '.' . $extension, FALSE);
$model->avatar->saveAs(Yii::app()->basePath . '/../images/avatars/' . $model->id . '.' . $extension);