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