title: image not stored on server using buffer reader in android
body: <p>First I am consverting user selected image to base 64 string then i am sending this image to php server, There i am not getting complete base64 string. I don't  know whats the problem.</p>
  
  <p>Here is code:-</p>
  
  <pre><code> File file = new File(imagepath);
   //encodeImagetoString convert image to base64 string
   encodeImagetoString();
   //encodedString is a base64 string
   String imageString= encodedString; 
   EditText text= (EditText) rootView.findViewById(R.id.editText2);
   String shayaritext=text.getText().toString();
   Spinner mySpinner=(Spinner) rootView.findViewById(R.id.spinner1);
   String catValue = mySpinner.getSelectedItem().toString();
   UserFunctions userFunction = new UserFunctions();
   json = userFunction.uploadShayariData(shayariName,catValue,shayaritext, imageString);
  </code></pre>
  
  <p>uploadShayariData function:-</p>
  
  <pre><code> @SuppressWarnings({ "deprecation", "deprecation" })
  public JSONObject uploadShayariData(String name,String catValue,String shayaritext,String image){
      // Building Parameters
      List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
      params.add(new BasicNameValuePair("tag", shayariUpload));
      params.add(new BasicNameValuePair("cat", catValue));
      params.add(new BasicNameValuePair("title", name));
      params.add(new BasicNameValuePair("data", shayaritext));
      params.add(new BasicNameValuePair("image", image));
  
      // getting JSON Object
      JSONObject json = jsonParser.getJSONFromUrl(registerURL, params);
      // return json
      return json;
      }
  </code></pre>
  
  <p>PHP code:-</p>
  
  <pre><code>  $image3=$_POST['image'];
    // Get file name posted from Android App
    $filename = "a.png";
   // Decode Image
   $binary=base64_decode($base);
   header('Content-Type: bitmap; charset=utf-8');
   // Images will be saved under 'www/imgupload/uplodedimages' folder
   $file = fopen('uploads/'.$filename, 'wb');
   // Create File
   fwrite($file, $binary);
   fclose($file);
  </code></pre>