When i use my application in localhost, it works fine, but when i try this functionnality in a distant server, i get the error message:
file_put_contents(/Users/brice/downloads/Groupe38.csv): failed to open stream: No such file or directory
I tried several codes (//Users instead of /Users, /Macintosh HD/Users, …) but none works for my mac. I changed the access rights (all permits for all in the repository), but it doesn’t work better for this…
I’m using SSL access, but i don’t think this is the problem cause my uploads are working.
Did someone know the good way to describe mac destination?
the thing is that’s working on localhost but not on distant server, maybe i’m forgetting to declare my local drive for the application, but i don’t really understand if i need to and how to do that?
Just to end, it work with this code in my controller:
...
// dans un premier temps, on place le fichier sous /protected/downloads
$dir = Yii::getPathOfAlias('application.downloads');
$filename = $dir.'/Groupe'.$group_id.'.csv';
$content = $csv->toCSV($filename, ",", "\"");
// on va ensuite transferer le fichier sur le poste local
return Yii::app()->getRequest()->sendFile(basename($filename), @file_get_contents($filename));
// suppression du fichier en fin de traitement
unlink($dir.'/'.$filename);