Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter – The upload destination folder does not appear to be writable

I'm using CodeIgniter's upload helper and received the above error when trying to upload an image. The permissions for the folder I'm trying to upload to are 755. When I changed it to 777, the error went away, but isn't 777 kind of a security risk?

I'm running on Apache. Is there a better way to allow users to upload files without setting the folder permissions to 777? How can I get 755 to work?

Thanks for the help!

like image 212
anniebabannie Avatar asked Nov 29 '22 12:11

anniebabannie


1 Answers

If the folder is for loading files by users than permisision 777 is required.

It's up to you to validate what files are loaded through upload script. Also you can use .htaccess to alow or not alow certain files to be executed from that directory.

The documentation for upload in codeigniter it's pretty simple and intuitive. Also here you can look at some ways to validate the type of files that are uploaded https://codeigniter.com/userguide3/libraries/file_uploading.html

like image 176
Cristian Bitoi Avatar answered Dec 04 '22 03:12

Cristian Bitoi