jpeterson579's avatar

NotWritableException in Image.php line 143: Can't write image data to path

Hi all so I am getting the following error when trying to upload an image in my laravel project. I am running on a Ubuntu server with laravel 5.3

NotWritableException in Image.php line 143: Can't write image data to path

However when i change the folder permissions that the image is being uploaded to, to 777 it works!

I dont want my folders being 777 though because its not safe right?

So what do I do to fix this?

0 likes
2 replies
Snapey's avatar

Ignore that last response (I'm sure you will)

Are you saving in the storage folder? You need permissions of 755. I bookmarked this thread as it has good advice https://laracasts.com/discuss/channels/general-discussion/laravel-framework-file-permission-security

You also need to consider which account is doing the writing and make sure that have the write group membership (usually www-data)

By the way, @Nagibaba, when reading and writing files from scripts you need to use the path of the file and not the URL.

Please or to participate in this conversation.