Mengatasi permission_denied Upload file di file system Ubuntu PHP

Beberapa saat lalu, saya mengalami masalah dalam mengupload file gambar.

move_upload_file($_FILES['file']['tmp_name'], "../..uploads/".$file_name);

Setelah kode tersebut di jalankan, maka akan menampilkan error seperti berikut :

Warning: move_uploaded_file(blablabla): failed to open stream: Permission denied in /var/www/html/test/action.php on line 15
Warning: move_uploaded_file(): Unable to move ‘/tmp/phpoVW8Z2’ to ‘../../uploads/Screenshot from 2017–07–29 17–42–08.png’ in /var/www/html/test/action.php on line 15

Solution is…

Masuk ke terminal dan ketikkan :

sudo chmod -R 777 /var/www/html/test/uploads

atau

sudo chmod -R ugo+rwx /var/www/html/test/uploads

Semoga Bermanfaat.

Refrensi :

http://www.pixelqi.com/file-permissions-chmod-777-meaning/

https://www.linux.com/LEARN/HOW-MANAGE-FILE-AND-FOLDER-PERMISSIONS-LINUX

Show your support

Clapping shows how much you appreciated Fadli Hidayatullah’s story.