title: How to read byte array in php
body: <p>I am sending a mp3 file using the following code  to a server.In server I want a php code to receive this byte array of mp3 and convert it into file and store it there.</p>
  
  <pre><code>try {
      final ByteArrayOutputStream out = new ByteArrayOutputStream();
      File file = new File(Environment.getExternalStorageDirectory()+ "/my.mp3");
      final InputStream in = new FileInputStream(file);
      final byte[] buf = new byte[2048];
      int n;
      while ((n = in.read(buf)) &gt;= 0) {
          out.write(buf, 0, n);
      }
      final byte[] data = out.toByteArray();
      String urlString = "http://10.0.0.56/upload.php";
      HttpPost postRequest = new HttpPost(urlString);
      postRequest.setEntity(new ByteArrayEntity(data));
      HttpClient client = new DefaultHttpClient();
      HttpResponse response = client.execute(postRequest);
      HttpEntity entity = response.getEntity();
      InputStream ins = entity.getContent();
      BufferedReader br = new BufferedReader(new InputStreamReader(ins));
      String temp_str;
      StringBuilder sb = new StringBuilder();
      while((temp_str = br.readLine()) != null) {
          sb.append(temp_str);
      }
      Log.e("response", sb.toString());
  } catch (Exception e) {
      // handle exception here
      Log.e(e.getClass().getName(), e.getMessage());
      return "exception";
  }
  </code></pre>
  
  <p>Any one know how to read the mp3 file using php.</p>