Lo he hecho funcionar con un apaño pero es incorrecto...He puesto a piñon, tanto la direccion del servidor absoluta como la web y me funciona. De la siguiente forma...
Código PHP:
public function getAbsolutePath()
{
return null === $this->path ? null : $this->getUploadRootDir().'/'.$this->path;
}
public function getWebPath()
{
return '/miproyecto2/web/bundles/acmedemo/upload/Productos';
}
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 when displaying uploaded doc/image in the view.
return '/usr/local/zend/apache2/htdocs/miproyecto2/web/bundles/acmedemo/upload/Productos';
}
public function upload()
{
// the file property can be empty if the field is not required
if (null === $this->file) {
return;
}
// we use the original file name here but you should
// sanitize it at least to avoid any security issues
// move takes the target directory and then the target filename to move to
$this->file->move($this->getUploadDir(), $this->file->getClientOriginalName());
// set the path property to the filename where you've saved the file
$this->setRutaimagen($this->getWebPath()."/". $this->file->getClientOriginalName());
// clean up the file property as you won't need it anymore
$this->file = null;
}