Codeigniter save captured image to folder

i have issue regarding image capture from the following code below in web host and also this code is capturing image in local host and storing the image to the folder but in web host it does not i do not have any error showing up in web-host please can some one help me . iam using codeigniter framework

// [4] WHEN WE CLICK ON "TAKE PHOTO" BUTTON
    take.addEventListener("click", function(){
      // Create snapshot from video
      var draw = document.createElement("canvas");
      draw.width = video.videoWidth;
      draw.height = video.videoHeight;
      var context2D = draw.getContext("2d");
      context2D.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
      // Upload to server
      draw.toBlob(function(blob){
        var data = new FormData();
        data.append('upimage', blob);
        var xhr = new XMLHttpRequest();
 xhr.open('POST', "User/adde", true);
        xhr.onload = function(){
          if (xhr.status==403 || xhr.status==404) {

            alert("ERROR LOADING 3-UPLOAD.PHP");
          } else {
            alert(this.response);
          }
        };
        xhr.send(data);
      });
    });
  })

controller

 $upimage = $this->input->post("upimage");
    


    $filename =  time() . '.jpg';


 


    $file="upload/".$filename;

    
   
    $filepath=FCPATH.'upload/'.$filename;
    
        $result=(move_uploaded_file($_FILES['upimage']['tmp_name'], $filepath));

I would tell you to check the error log and verify that you are not getting an error, just because it doesn’t show on the screen, doesn’t mean that there isn’t an error.

Hi , i have checked all issues and still the outcome is same and as i store things such as name and date with the image which is stored in the database but the image wont be stored in the folder

Right click on your page navigate to inspect, then to network,
After take a PHOTO then look for your function in the network, check out the status,
if everything is good try debugging your code like print_r() die()
first check if you are receiving the data in the controller

Sponsor our Newsletter | Privacy Policy | Terms of Service