현장 확인 업로드
This commit is contained in:
@@ -54,7 +54,7 @@ class MyUpload
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일 업로드 요청
|
||||
* 파일 업로드 요청 (Object Storage 전용)
|
||||
* 추가일 2025.12.24
|
||||
* 작성자 - yangsh
|
||||
*/
|
||||
@@ -73,39 +73,40 @@ class MyUpload
|
||||
|
||||
$newName = $file->getRandomName();
|
||||
|
||||
// ✅ PHP 임시 업로드 파일 경로 (writable로 move() 필요 없음)
|
||||
// ✅ PHP 임시 업로드 파일 경로
|
||||
$tmpFile = $file->getTempName();
|
||||
if (!is_file($tmpFile)) {
|
||||
$this->set_error('upload_temp_file_missing');
|
||||
log_message('error', 'do_upload2 temp file missing: ' . $tmpFile);
|
||||
log_message('error', '[MyUpload] Temp file missing: ' . $tmpFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
// ✅ 클라우드에 올라갈 "Key"를 직접 만든다 (로컬 경로 절대 넣지 말기)
|
||||
// 예시: upload/tmp/랜덤파일명 또는 upload/apt_file/{rcpt_no}/...
|
||||
// ✅ 클라우드에 올라갈 "Key"
|
||||
$objectKey = $filePath . $newName;
|
||||
|
||||
// 클라우드 업로드 (필수)
|
||||
$up = $this->upload_object_storage($objectKey, $tmpFile, 'file');
|
||||
|
||||
if ($up === false) {
|
||||
$this->set_error('upload_destination_cloud_error');
|
||||
$this->set_error('cloud_upload_failed');
|
||||
log_message('error', '[MyUpload] Cloud upload failed: ' . $objectKey);
|
||||
@unlink($tmpFile);
|
||||
return false;
|
||||
}
|
||||
|
||||
// (선택) tmp 파일 삭제
|
||||
// tmp 파일 삭제
|
||||
@unlink($tmpFile);
|
||||
|
||||
$this->s3_data = [
|
||||
'object_key' => $objectKey,
|
||||
'object_storage_url' => $up['object_storage_url'] ?? null,
|
||||
'origin_name' => $file->getClientName(),
|
||||
'file_name' => basename($objectKey), // xxxx.jpg
|
||||
'base_name' => pathinfo($objectKey, PATHINFO_FILENAME), // xxxx
|
||||
'ext' => pathinfo($objectKey, PATHINFO_EXTENSION), // jpg
|
||||
'file_name' => basename($objectKey),
|
||||
'base_name' => pathinfo($objectKey, PATHINFO_FILENAME),
|
||||
'ext' => pathinfo($objectKey, PATHINFO_EXTENSION),
|
||||
];
|
||||
|
||||
|
||||
log_message('debug', 's3_data=' . json_encode($this->s3_data ?? null, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
||||
|
||||
log_message('info', '[MyUpload] Cloud upload success: ' . $objectKey);
|
||||
|
||||
return $this->s3_data;
|
||||
}
|
||||
@@ -386,6 +387,7 @@ class MyUpload
|
||||
'Key' => ltrim($object_storage_upload_path, '/'),
|
||||
'Body' => $blobData,
|
||||
'ACL' => 'public-read',
|
||||
'ContentType' => 'image/jpeg',
|
||||
]);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user