Note that there are some explanatory texts on larger screens.

plurals
  1. POonly 1kb size of file is getting uploaded onto the server
    primarykey
    data
    text
    <p>I am successfully getting file from sdcard and from there i am able to get outputstream and here i am checking its available size and i am getting size, now at the time of upload using byteoutputstream, only 1Kb is getting uploaded onto the server? what is the possible problem in it. here is my code snippets,</p> <pre><code>public String PostData(String path) { try { SharedPreferences preferences = getSharedPreferences( LoginPageActivity.MYPREF, 0); HttpClient httpClient = new DefaultHttpClient(); HttpContext localContext = new BasicHttpContext(); HttpPost httpPost = new HttpPost( "http://www.idolgreeting.com/app/movie_done.php" /* + postStr */); MultipartEntity entity = new MultipartEntity( HttpMultipartMode.BROWSER_COMPATIBLE); Log.d("System out", "path is "+path); FileInputStream fileInputStream = new FileInputStream( new File(path)); ByteArrayOutputStream bos = new ByteArrayOutputStream(); int bytesavailable = fileInputStream.available(); Log.d("System out", "bytes available "+bytesavailable); byte[] buffer = new byte[bytesavailable]; int test = fileInputStream.read(buffer, 0, bytesavailable); Log.d("System out", "test "+test); // bos.write(test); // int maxBufferSize =1000; while (test &gt; 0) { bos.write(buffer, 0, bytesavailable); bytesavailable = fileInputStream.available(); bytesavailable = Math.min(bytesavailable, maxBufferSize); test= fileInputStream.read(buffer, 0, bytesavailable); Log.d("System out", "test in while loop"+test); } byte[] data = bos.toByteArray(); Log.d("System out", "Length is "+data.length); if (imagePath.contains(".mp4")) { entity.addPart("_filename", new StringBody("newFile.mp4")); Log.d("System out", "MP4 file "); } else { entity.addPart("_filename", new StringBody("newFile.3gp")); Log.d("System out", "3GP file "); } String[] userID = preferences.getString(LoginPageActivity.USER, null).split("#"); Log.d("System out", "user id " + userID[0]); Log.d("System out", "user id " + userID[1]); // entity.addPart("userid", new StringBody(preferences.getString( // LoginPageActivity.USER, null))); entity.addPart("userid", new StringBody(userID[0])); entity.addPart("taskid", new StringBody(bundle.getString("id"))); entity.addPart("_Get", new StringBody("&amp;android=1")); if (imagePath.contains(".mp4")) { entity.addPart("uploaded", new ByteArrayBody(data, "newFile.mp4")); Log.d("System out", "MP4 file "); } else { entity.addPart("uploaded", new ByteArrayBody(data, "newFile.3gp")); Log.d("System out", "3GP file "); } httpPost.setEntity(entity); HttpResponse response = httpClient.execute(httpPost, localContext); BufferedReader reader = new BufferedReader(new InputStreamReader( response.getEntity().getContent(), "UTF-8")); String sResponse = reader.readLine(); Log.d("System out", "response " + sResponse); if (sResponse.equalsIgnoreCase("true")) { dataFlag = true; } else { dataFlag = false; } handler.sendEmptyMessage(0); return sResponse; } catch (Exception e) { // if (dialog.isShowing()) // dialog.dismiss(); // Toast.makeText(getApplicationContext(), // e.getMessage(), // Toast.LENGTH_LONG).show(); Log.e(e.getClass().getName(), e.getMessage(), e); dataFlag = false; handler.sendEmptyMessage(0); return null; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload