
Laravel에서 파일 업로드를 위해 사용하는 경로는 `public_path()` method를 사용하여 `/public` 폴더에 저장됩니다.
예를 들어, `public_path()` method를 사용하여 파일을 업로드 할 때, 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$file_path = public_path('uploads/' . $file_name);
위 코드는 `/public/uploads/` 폴더에 파일을 업로드 할 것입니다.
파일을 업로드 할 때 권한 설정은 다음과 같이 할 수 있습니다.
#hostingforum.kr
php
chmod($file_path, 0755);
위 코드는 `/public/uploads/` 폴더의 권한을 755로 설정할 것입니다.
또한, Laravel에서 제공하는 `Storage` facade를 사용하여 파일을 업로드 할 수도 있습니다.
#hostingforum.kr
php
use IlluminateSupportFacadesStorage;
$file_path = Storage::putFile('uploads/' . $file_name, $file);
위 코드는 `/public/uploads/` 폴더에 파일을 업로드 할 것입니다.
파일을 업로드 할 때 권한 설정은 다음과 같이 할 수 있습니다.
#hostingforum.kr
php
chmod(public_path('uploads/' . $file_name), 0755);
위 코드는 `/public/uploads/` 폴더의 권한을 755로 설정할 것입니다.
2025-04-28 19:50