There is a certain form in which digital values like "777", "644", etc. are written. then the value of this form is sent by javascript to the php script and passed to the chmod function, but the following syntax will be valid for this function:
chmod($name, 0777);
and the value for the function is transmitted in the form of three digits, and not four:
$name = $_POST['name']; $chm = $_POST['chm']; // 777 например chmod($name, $chm);
how to make from 777 0777? I tried different types of options:
$cmd = '0'.$cmd;
but the rights to the file were set completely different, maybe there is a solution on js, like adding zero to the number from the form before sending