R2 파일 업로드
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user