title: showing progress bar while uploading a video
body: <p>I want to show progress bar while uploading a video from my app to php server.The below will upload the file to the server correctly.But i dont know how to show the progress bar.If anybody knows pls help me.</p>
  
  <p>Here is my code:</p>
  
  <pre><code> private void doFileUpload(){
              HttpURLConnection conn = null;
              DataOutputStream dos = null;
              DataInputStream inStream = null;
              String lineEnd = "\r\n";
              String twoHyphens = "--";
              String boundary =  "*****";
              int bytesRead, bytesAvailable, bufferSize;
              byte[] buffer;
              int maxBufferSize = 8*1024*1024;
              Cursor c = (MainscreenActivity.JEEMAHWDroidDB).query((MainscreenActivity.TABLE_Name), new String[] {
                       (MainscreenActivity.COL_HwdXml)}, null, null, null, null,
                                null);
               if(c.getCount()!=0){
               c.moveToLast();
               for(int i=c.getCount()-1; i&gt;=0; i--) {
                    value=c.getString(0);           
               }
               }
              String urlString = value+"/upload_file.php";
              try
              {
               //------------------ CLIENT REQUEST
                  UUID uniqueKey = UUID.randomUUID();
                  fname = uniqueKey.toString();
                  Log.e("UNIQUE NAME",fname);
  
              FileInputStream fileInputStream = new FileInputStream(new File(selectedPath) );
              URL url = new URL(urlString);
              conn = (HttpURLConnection) url.openConnection();
              conn.setDoInput(true);
              conn.setDoOutput(true);
              conn.setUseCaches(false);
              conn.setRequestMethod("POST");
              conn.setRequestProperty("Connection", "Keep-Alive");
              conn.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary);
              dos = new DataOutputStream( conn.getOutputStream() );
               dos.writeBytes(twoHyphens + boundary + lineEnd);
               dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\"" + fname + "."+extension+"" + lineEnd);
               dos.writeBytes(lineEnd);
               bytesAvailable = fileInputStream.available();
               System.out.println("BYTES:---------&gt;"+bytesAvailable);
               bufferSize = Math.min(bytesAvailable, maxBufferSize);
               System.out.println("BUFFER SIZE:---------&gt;"+bufferSize);
               buffer = new byte[bufferSize];
               System.out.println("BUFFER:---------&gt;"+buffer);
               bytesRead = fileInputStream.read(buffer,0,bufferSize);
               System.out.println("BYTES READ:---------&gt;"+bytesRead);
               while (bytesRead &gt; 0)
               {
                dos.write(buffer, 0, bufferSize);
                bytesAvailable = fileInputStream.available();
                bufferSize = Math.min(bytesAvailable, maxBufferSize);
                bytesRead = fileInputStream.read(buffer, 0, bufferSize);
                System.out.println("RETURNED");
               }
               dos.writeBytes(lineEnd);
               dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
  
               Log.e("Debug","File is written");
               fileInputStream.close();
               dos.flush();
               dos.close();
  
              }
              catch (MalformedURLException ex)
              {
                   Log.e("Debug", "error: " + ex.getMessage(), ex);
              }
              catch (IOException ioe)
              {
                   Log.e("Debug", "error: " + ioe.getMessage(), ioe);
              }
              //------------------ read the SERVER RESPONSE
              try {
                    inStream = new DataInputStream ( conn.getInputStream() );
                    String str;
  
                    while (( str = inStream.readLine()) != null)
                    {
                         Log.e("Debug","Server Response "+str);
                    }
                    inStream.close();
  
              }
              catch (IOException ioex){
               Log.e("Debug", "error: " + ioex.getMessage(), ioex);
              }
  </code></pre>