I have read so many questions which bear the same title as mine, but none of them has helped me..
Above image is the output of the following function..
foreach ( $products as $product) {
$file = Library::getCatalogUploadPath().$product['image'];
echo $file.'<br>';
if( file_exists($file)){
echo $file;
}
else {
echo "no".'<br>';
}
}
And Here is the function getCatalogUploadPath()...
public function getCatalogUploadPath()
{
return Yii::app()->params['config']['document_root'].Yii::app()->params['config']['upload_path'].'catalog/';
}
and Here is the 'config'..
'config' => array(
'site_url' =>
'http://l/git/cart.git/',//example:http://www.cartnex.org/
'document_root' => $_SERVER['DOCUMENT_ROOT'],
'upload_path'=>'git/cart.git/uploads/',
)
PROOF THAT THE FILE EXISTS :
The filename $product['image']
is malformed. It doesn't contain file extension, which is why file_exists()
returns false