title: errro in Uploading base64 image from android to server using php
body: <p>I am uploading an image from phone gallery to my database . I am posting the base64 string of the image to server .Here is my php code.</p>
  
  <pre><code>    &lt;?php 
  
   define('DB_HOST', 'localhost');
   define('DB_USER', 'root');
   define('DB_PASS', '');
   define('DB_NAME', 'sample_userdata');
  
   //connecting to database and getting the connection object
   $conn = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
  
  if($conn)
  {
      $image=$_POST["image"];
      $uploadpath="uploads/profilepic.jpg";
      if(isset($image)){
          if(file_put_contents($uploadpath,base64_decode($image))){
          echo json_encode(array('response'=&gt;'Image Uploaded successfully'));}
  
      }else{
          echo json_encode(array('response'=&gt;'Image upload failed'));
      }
  }else{
  
  echo json_encode(array('response'=&gt;'Image upload failed 2'));}
  mysqli_close($conn);
  ?&gt;
  </code></pre>
  
  <p>The image is getting saved in the uploads folder successfully and android logcat is showing the response </p>
  
  <blockquote>
    <p>D/Response: {"response":"Image Uploaded successfully"}</p>
  </blockquote>
  
  <p>But the localhost/profilepic.php which contains the code is showing Notice: </p>
  
  <blockquote>
    <p>Undefined index: image in C:\xampp\htdocs\profilepic.php on line 13
    {"response":"Image upload failed"}</p>
  </blockquote>
  
  <p>what is the problem , the image is successfully stored in uploads folder , android is giving success message but the localhost page is giving error.</p>