- Laravel Version: 5.8.29
- PHP Version
$ php --version: PHP 7.2.24 (cli)
I’m unable to download file from s3 to local disk using
put method in created directory.
ErrorException (E_WARNING) : file_put_contents(/path/storage/4804_1626): failed to open stream: Is a directory
However, I’ve found that directory has been created with below permission. I tried setting permission
777 as passing third parameter in
makeDirectory() method but it didn’t work.
<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7c091e091208093c150c">[email protected]</a>:~/path/storage$ ll drwxr-xr-x 2 www-data www-data 4096 Sep 20 07:07 4804_1626/
Files & Configuration:
$folderPath = Storage::disk('local')->makeDirectory($folderName, 0777); $contents = Storage::disk('s3')->get('path/' . $fileName); Storage::disk('local')->put($folderName, $contents); // Following line is throwing error
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
You need to specify full path to file, not only folder:
Storage::disk('local')->put($folderName . '/' . $fileName, $contents);