title: How to parse a php message with Java - incorrect HTTP format issue
body: <p>I'm following this tutorial.</p>
  
  <p><a href="http://www.androidhive.info/2014/12/android-uploading-camera-image-video-to-server-with-progress-bar/" rel="nofollow">http://www.androidhive.info/2014/12/android-uploading-camera-image-video-to-server-with-progress-bar/</a></p>
  
  <p>If you follow the tutorial, I've saved the fileUpload.php to my server.</p>
  
  <p><a href="http://68.169.50.115/AndroidFileUpload/fileUpload.php" rel="nofollow">http://68.169.50.115/AndroidFileUpload/fileUpload.php</a></p>
  
  <p>And this is message. I've received in JSON format when you've "successfully" saved the picture to the server. Problem is the link doesn't work, nor does the file picture actually save to my server. </p>
  
  <pre><code>    private void showAlert(String message) {
          AlertDialog.Builder builder = new AlertDialog.Builder(this);
          builder.setMessage(message).setTitle("Response from Servers")
                  .setCancelable(false)
                  .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int id) {
                          // do nothing
                      }
                  });
  
          Log.d("OGG", "JSON: " + message);
          AlertDialog alert = builder.create();
          alert.show();
      }
  
  }
  </code></pre>
  
  <p>This is the response from the Log.d, the JSON message formed by the picture. </p>
  
  <p>03-13 16:40:24.725: D/OGG(5158): Link: {"error":false,"message":"File uploaded successfully!","file_path":"http://68.169.50.115/AndroidFileUpload/IMG_20150313_164010.jpg"}</p>
  
  <p>It says that the picture exists but if you try the link.. </p>
  
  <p>http://68.169.50.115/AndroidFileUpload/IMG_20150313_164010.jpg</p>
  
  <p>It doesn't work.</p>
  
  <p>Is it not working properly because I have the php file saved on my cloud server and not on my personal computer like the tutorial dictates?</p>
  
  <p>Why is the file not actually saving. </p>
  
  <p>Here's the the file upload.php</p>
  
  <pre><code>&lt;?php
  
  
  
  // Path to move uploaded files
  $target_path = "uploads/";
  
  // array for final json respone
  $response = array();
  
  // getting server ip address
  $server_ip = gethostbyname(gethostname());
  
  // final file url that is being uploaded
  //$file_upload_url = 'http://' . $server_ip . '/';
  
  $file_upload_url = 'http://' . $server_ip . '/' . 'AndroidFileUpload' . '/';
  
  
  if (isset($_FILES['image']['name'])) {
  $target_path = $target_path . basename($_FILES['image']['name']);
  
  
  // reading other post parameters
  $email = isset($_POST['email']) ? $_POST['email'] : '';
  $website = isset($_POST['website']) ? $_POST['website'] : '';
  
  
  
   try {
   // Throws exception incase file is not being moved
  
  
   if (!move_uploaded_file($_FILES['image']['tmp_name'], $target_path)) {
   // make error flag true
   $response['error'] = true;
   $response['message'] = 'Could not move the file!';
  }
  
  
   // File successfully uploaded
   $response['message'] = 'File uploaded successfully!';
   $response['error'] = false;
  
   $response['file_path'] = $file_upload_url . basename($_FILES['image']['name']);
   } catch (Exception $e) {
   // Exception occurred. Make error flag true
   $response['error'] = true;
     $response['message'] = $e-&gt;getMessage();
   }
  } else {
   // File parameter is missing
  $response['error'] = true;
   $response['message'] = 'Not received any file!F';
  }
  
  // Echo final json response to client
  echo json_encode($response);
  ?&gt;
  </code></pre>