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)]; }
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)]; }
/** * 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)); }
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())]; }