public function showFile($id, $idFile) { $filePath = $this->service->getFilePath($idFile); $fileContent = file_get_contents($filePath); $file64 = base64_encode($fileContent); return ['file' => $file64, 'size' => filesize($filePath), 'name' => $this->service->getFileName($idFile)]; }
public function showFile($projectId, $id) { $filePath = $this->service->getFilePath($id); $fileContent = file_get_contents($filePath); $file64 = base64_encode($fileContent); return ['file' => $file64, 'size' => filesize($filePath), 'name' => $this->service->getFileName($id), 'mime_type' => $this->service->getMimeType($id)]; }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function showFile($id, $idFile) { $model = $this->repository->skipPresenter()->find($idFile); $filePath = $this->service->getFilePath($idFile); $fileContent = file_get_contents($filePath); $file64 = base64_encode($fileContent); return ['file' => $file64, 'size' => filesize($filePath), 'name' => $this->service->getFileName($idFile), 'mime_type' => $this->storage->mimeType($model->getFileName())]; }
public function showFile($id) { if (!$this->service->checkProjectPermissions($id)) { return $this->erroMsgm("O usuário não tem acesso a esse projeto"); } $filePath = $this->service->getFilePath($id); $fileContent = file_get_contents($filePath); $file64 = base64_encode($fileContent); return ['file' => $file64, 'size' => filesize($filePath), 'name' => $this->service->getFileName($id)]; }
public function showFile($id) { if ($this->service->checkProjectPermissions($id) == false) { return ['error' => 'Access Forbidden']; } $filePath = $this->service->getFilePath($id); $fileContent = file_get_contents($filePath); $file64 = base64_encode($fileContent); return ['file' => $file64, 'size' => filesize($filePath), 'name' => $this->service->getFileName($id)]; }
public function showFile($id, $idFile) { //if($this->service->checkProjectPermissions($id) == false){ // return ['error' => 'Access Forbidden']; //} $filePath = $this->service->getFilePath($idFile); $fileContent = file_get_contents($filePath); $file64 = base64_encode($fileContent); return ['file' => $file64, 'size' => filesize($filePath), 'name' => $this->service->getFileName($idFile)]; //return response()->download($this->service->getFilePath($id)); }
/** * @param $projectId * @param $fileId * @return array|\Symfony\Component\HttpFoundation\BinaryFileResponse */ public function showFile($projectId, $fileId) { $file = $this->service->getFile($projectId, $fileId); $filePath = $this->service->getFilePath($projectId, $fileId); $fileContent = file_get_contents($filePath); $fileContent64 = base64_encode($fileContent); return ['name' => $file->file, 'file' => $fileContent64, 'size' => filesize($filePath)]; }
public function showFile($id, $idFile) { if ($this->projectService->checkProjectPermissions($id) == false) { return ['error' => 'Access Forbidden']; } $model = $this->repository->skipPresenter()->find($idFile); $filePath = $this->service->getFilePath($idFile); $fileContent = file_get_contents($filePath); $file64 = base64_encode($fileContent); return ['file' => $file64, 'size' => filesize($filePath), 'name' => $this->service->getFileName($idFile), 'mime_type' => $this->storage->mimeType($model->getFileName())]; }