Unable to Upload File in Laravel

"failed to open stream: Is a directory in /vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php:119"

This is the error in my logs when trying to upload a file.

My Controller code is simple. It stores the user uploaded file to s3.

$request->image->storeAs($dir, $new_file_name, 's3');

$request->image->storeAs($dir, $new_file_name, 's3');

Tracking it down, I found that the path being returned for the temporary file was to my public web directory. Long story short, the file exceeded my max upload limit (in php.ini), so PHP was not providing a path in the file info when getRealPath was called.

Increasing the upload_max_filesize and post_max_size did the trick. I should also mention that I spent hours figuring this out because I thought I'd already changed those settings. Turns out I had made the changes in the wrong php.ini file (in the cli directory). Once I updated the php.ini file in the fpm directory and restarted PHP, I was golden.


I had two versions of PHP running on different websites. I ran phpinfo() on one site and it returned 7.1. On another site (the one I'm having the upload issue) it returned 7.2. And the max_file_upload was 2M.

About Me

I'm a web developer from Knoxville, TN. I've been married for over 20 years and have two kids. During the day, I work at Warren Lamb writing software with a great team of developers. After the kids are nestled all snug in their beds, I run AgentBlaze, a small business that creates websites for real estate pros.