
CURLStringFile::__construct($filename, $fileupload)에서 $filename은 업로드된 파일의 이름을 의미하고, $fileupload은 업로드된 파일의 경로를 의미합니다.
이러한 경우, PHP의 임시 디렉토리(/tmp 디렉토리)에서 파일이 업로드됩니다.
업로드된 파일의 경로는 PHP의 임시 디렉토리에서 생성되며, 업로드가 완료된 후 PHP가 종료되면 자동으로 삭제됩니다.
만약 업로드된 파일을 유지하고 싶다면, PHP의 임시 디렉토리에서 파일을 복사하여 원하는 디렉토리에 저장하면 됩니다.
예를 들어, 업로드된 파일을 /var/www/html/upload 디렉토리에 저장하고 싶다면, 다음과 같이 코드를 작성할 수 있습니다.
#hostingforum.kr
php
$uploadDir = '/var/www/html/upload';
$filename = 'example.txt';
$fileupload = curl_file_create($filename, 'text/plain', $filename);
// 업로드된 파일을 임시 디렉토리에서 복사하여 원하는 디렉토리에 저장
$uploadFile = $uploadDir . '/' . $filename;
file_put_contents($uploadFile, file_get_contents($fileupload));
이러한 코드를 통해 업로드된 파일을 원하는 디렉토리에 저장할 수 있습니다.
2025-06-17 14:51