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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top