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

@@ -54,18 +54,16 @@ public function upload(UploadedFile $file, ?string $description = null): File
$storedName
);
// Store file
Storage::disk('tenant')->putFileAs(
dirname($tempPath),
$file,
basename($tempPath)
);
// Store file to R2 (Cloudflare R2, S3 compatible)
Storage::disk('r2')->put($tempPath, file_get_contents($file->getRealPath()), [
'ContentType' => $file->getMimeType(),
]);
// Determine file type
$mimeType = $file->getMimeType();
$fileType = $this->determineFileType($mimeType);
// Create DB record
// Create DB record (file_path = R2 key path)
$fileRecord = File::create([
'tenant_id' => $tenantId,
'display_name' => $file->getClientOriginalName(),