title: Android app doesnt send picture to database PHP MYSQL
body: <p>I have a problem, because the picture isnt sent to my database. I used different PHP file which doesnt decode picture again and everything works fine, all results appear in my database, but when I try to connect to that file it doesnt work. This is the php that doesnt work properly:</p>
  
  <pre><code>&lt;?php
  
  header('Content-type : bitmap; charset=utf-8');
  
  if(isset($_POST["encoded_string"])){
  
  $username = $_POST["username"];
  $description = $_POST["description"];
  $encoded_string = $_POST["encoded_string"];
  
  $decoded_string = base64_decode($encoded_string);
  
  $path = 'place on server where I want pictures to be sent' ;
  
  $file = fopen($path, 'wb');
  
  $is_written = fwrite($file, $decoded_string);
  fclose($file);
  
  if($is_written &gt; 0){
      $con = mysqli_connect("localhost", "xx", "xx", "xx");
      $query = "INSERT INTO meals(username, description, image) values('$username', '$description' , '$path');";
  
      $result = mysqli_query($con, $query);
  
      if($result){
          echo "success";
      }else{
          echo "failed";
      }
  
      mysqli_close($con);
  }   
  }
  
  ?&gt;
  </code></pre>
  
  <p>And that one send details properly but not in the way I would like to:</p>
  
  <pre><code>&lt;?php
   $con = mysqli_connect("localhost", "xx", "xx", "xx");
  
  $username = $_POST["username"];
  $description = $_POST["description"];
  $encoded_string = $_POST["encoded_string"];
  
  $statement = mysqli_prepare($con, "INSERT INTO images (username, description, image) 
  VALUES (?, ?, ?)");
  mysqli_stmt_bind_param($statement, "sss", $username, $description, $encoded_string);
  mysqli_stmt_execute($statement);
  
  $response = array();
  $response["success"] = true;  
  
  echo json_encode($response);
  
  
  ?&gt;
  </code></pre>
  
  <p>Is it casued beacause I have to change FTP settings?</p>
  
  <p>the second code passes all data to database but image is in base64 format so there are plenty characters and it runs slowly. What I want to do is to be able to use the first code, but it doesn't decodes base64 to actual image I am sending and it shows no result in database nor folder in server.</p>