I have a simple PHP that will save a file to a specific folder. I already change the permission in 777 but I'm getting errors:
Warning: file_put_contents(/var/www/html/foldername/): failed to open stream: Is a directory on line 22
Warning: chmod(): Operation not permitted on line 23
How to fix these?
PHP
$file_name = '';
$file_binary = '';
$folder = "foldername";
$file_name = isset($_POST['file_name']) ? $_POST['file_name'] : '';
$file_binary = isset($_POST['file']) ? $_POST['file'] : '';
$file_directory = "/var/www/html/foldername/".$file_name;
file_put_contents($file_directory,str_replace("\\","",$file_binary));
chmod($file_directory,0777);