Reputation: 690
I am right now trying to figure out how I can move a file that got temporarily stored in storage/app/chunks to a public folder in order to save it there permanently.
I have tried
$chunk_file_path = "/storage/app/chunks/The Simpsons Movie - 1080p Trailer.mp4-YMtmuO4cEG4ejK6knZOEzZCxVie0NwDgdFqggThG-147399359.part";
$chunk_move_path = "uploads/The Simpsons Movie - 1080p Trailer.mp4-YMtmuO4cEG4ejK6knZOEzZCxVie0NwDgdFqggThG-147399359.part";
Storage::move($chunk_file_path, $chunk_move_path);
The problem I encounter is
FileNotFoundException in Filesystem.php line 385:
File not found at path: storage/app/chunks/The Simpsons Movie - 1080p Trailer.mp4-YMtmuO4cEG4ejK6knZOEzZCxVie0NwDgdFqggThG-147399359.part
The file does exist, but it seems like root folder is automatically the public folder of the Laravel installation. So it is looking in public/storage/app/chunks/The Simpsons Movie - 1080p Trailer.mp4-YMtmuO4cEG4ejK6knZOEzZCxVie0NwDgdFqggThG-147399359.part
and can't find it obviously, because it is not in the public folder hierarchy.
Any help is highly appreciated.
Upvotes: 0
Views: 1266
Reputation: 951
Open config/filesystems.php
and either 1) modify your public
settings, or create a new setting and pass it into Storage::disk('new_setting')->move($chunk_file_path, $chunk_move_path);
Such as:
'disks' => [
'videos' => [
'driver' => 'local',
'root' => '/some/path/here', // (I recommend still using `storage_path()` here
]
]
Storage::disk('videos')->move($chunk_file_path, $chunk_move_path)
See the Laravel documentation for Filesystems for more information (including making the files publicly accessible).
Upvotes: 1