wwwabcd
(Www Abcd)
December 24, 2014, 7:11pm
1
I have two folders for images.
Folder upload located in folder protected and folder images located in root.
I use function rename for transfer and rename images. but I get this error:
The system cannot find the path specified.
this is my code:
rename(Yii::app()->basePath.'/uploads/'.$uploadImagesName , Yii::app()->baseUrl().'/images/'imageName);
When two folders located in protected or root it’s work.
I can use $_SERVER[‘DOCUMENT_ROOT’].
What can I use Instead of $_SERVER[‘DOCUMENT_ROOT’]?
oligalma
(Marc Oliveras)
December 24, 2014, 8:30pm
2
change this
Yii::app()->baseUrl().’/images/'imageName
for this
Yii::app()->baseUrl().’/images/’ . $imageName
wwwabcd
(Www Abcd)
December 24, 2014, 10:45pm
3
Thank You for reply.
I accidentally deleted $ when I changed name of variable.
Yii::app()->baseUrl() not work.
It is solution:
Yii::getPathOfAlias(‘webroot’).’/images/’ . $imageName
alirz23
(Ali Raza)
December 25, 2014, 4:51am
4
<?php
// dirname() will take you one directory up
rename(Yii::app()->basePath.'/uploads/'.$uploadImagesName , dirname(Yii::app()->basePath).'/images/'.$imageName);