Search code examples
phpcodeignitercodeigniter-3move-uploaded-file

move_upload_file() is not uploading images inside directory?


I am using codeigniter-3 framework , i am getting file from the request i want to store that image inside the particular folder for that i am using move_upload_file() but it's not working can you please help me did i miss anything ..?

        $original_filename = $_FILES['file']['name'];
        $file_tmp  = $_FILES['file']['tmp_name'];
        move_uploaded_file($file_tmp, "profile_image/" . $original_filename);

directory

ProjectName
  -profile_image

Solution

    1. Check the permissions of the directory "profile_image" - you need write permissions.
    2. You entered a relative directory path - check if the current working directory is "ProjectName".