R2 파일 업로드

This commit is contained in:
김보곤
2026-03-11 17:49:16 +09:00
parent bbaeefb6b5
commit 0ab3d5ab88
12 changed files with 1145 additions and 845 deletions

View File

@@ -83,14 +83,25 @@ public function trash()
}
/**
* Download file
* Download file (attachment)
*/
public function download(int $id)
{
$service = new FileStorageService;
$file = $service->getFile($id);
return $file->download();
return $file->download(inline: false);
}
/**
* View file inline (이미지/PDF 브라우저에서 바로 표시)
*/
public function view(int $id)
{
$service = new FileStorageService;
$file = $service->getFile($id);
return $file->download(inline: true);
}
/**

View File

@@ -109,7 +109,7 @@ public function upload(int $id, ItemFileUploadRequest $request)
$filePath = $directory.'/'.$storedName;
// 파일 저장 (tenant 디스크)
Storage::disk('tenant')->putFileAs($directory, $uploadedFile, $storedName);
Storage::disk('r2')->putFileAs($directory, $uploadedFile, $storedName);
// file_type 자동 분류 (MIME 타입 기반)
$mimeType = $uploadedFile->getMimeType();