I managed to solve the problem. Basically my folder's permission is 0755. Then I change to 0777 that enable user to make folder (mkdir) in the server. You can learn more about permission here.
Unable to make directory (mkdir) in DirectAdmin
-
01-09-2022 - |
Question
I'm new in DirectAdmin. I'm facing a problem that when user try to create a folder, they will get error, "Unable to upload data."
(refer to my code).
I think my code should be no problem as it can run smoothly in Localhost. The problem rise when I run on live server (DirectAdmin).
$id = $this->session->userdata('id');
$directory = "./image/userFolder/" . $id;
if(!is_dir($directory)) {
mkdir($directory, 0777, true);
}
$directory = $directory . "/" . $nameImage;
if(!imagejpeg($big_image, $directory)) {
$data['error'] = "Unable to upload data.";
return $data;
}
Hope to get answer or maybe something that I can look after. Thank you.
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow