Call To Copy Keeps Giving Me An Error....

Trying to copy a file from one location to another and I keep getting this error


 [<a href='function.copy'>function.copy</a>]: failed to open stream: No such file or directory 

both the folder with the image and the destination folder have full read-write access.

here’s the simple code i’m trying execute


	$basefile = Yii::app()->baseUrl.'/images/users/img.jpg';

	$targetfle =Yii::app()->baseUrl.'/images/users/gen/img_copy.jpg'; 


	if(copy($basefile,$targetfle))

		return "success";

	else

		return "fail";



what else could be going on to cause this?

Use file system paths as parameters for file system functions. Web URLs are not likely to work in this case.


Yii::app()->basePath . '/images/users/img.jpg';

EDIT: Path aliases also can be used:


Yii::getPathOfAlias('webroot.images.users') . '/img.jpg'

awesome… never even thought of that… works like a charm

thanks!