I am trying to use the cookbook example on how to upload fiels with symfony2 : http://symfony.com/doc/2.0/cookbook/doctrine/file_uploads.html
The problem is that I am not able to get the path of the web folder.
Here are some details: In my web folder, I have a structure like that:
/web
/bundles
/sciforumversion2
/images
And from the entity, I I trying to get the folder path and save my image in the /images folder
For that, I am using:
protected function getUploadRootDir()
{
// the absolute directory path where uploaded
// documents should be saved
return __DIR__ . '/../../../../web/'.$this->getUploadDir();
}
protected function getUploadDir()
{
// get rid of the __DIR__ so it doesn't screw up
// when displaying uploaded doc/image in the view.
return 'sciforumversion2/bundles/images';
}
But I am getting then the exception that the directory can't be created:
Unable to create the "/home/milos/workspace/conference2.0/src/SciForum/Version2Bundle/Entity/../../../../web/sciforumversion2/bundles/images/conference" directory
Any idea on how could I get the web folder url and why the solution proposed by the symfony cookbook is not working is mostly welcome.
Thank you very much. Thank you.