get('net15.file.item.manager')->getByGUID($guid); //2 test si l'utilisateur a le droit de telecharger le fichier // si oui // Generate response $response = new Response(); // Set headers $response->headers->set('Cache-Control', 'private'); $response->headers->set('Content-type', $fileItem->getMime()); $response->headers->set('Content-Disposition', 'attachment; filename="' . $fileItem->getName() . '";'); $response->headers->set('Content-length', $fileItem->getSize()); // Send headers before outputting anything $response->sendHeaders(); $response->setContent(file_get_contents($fileItem->getDownloadPath())); return $response; //sinon on redirige vere une erreu 403 } }