현재 그림판 View를 버튼을 클릭하면 png파일로 만들어서 갤러리에 등록까지는 됩니다, 그리고 바로 서버로 전송시키려하는데 안되네요

일단소스는 너무길어서 중요한부분만 올리겟습니닷

//옵션메뉴버튼 클릭하면 구동

@Override
 public boolean onOptionsItemSelected(MenuItem item) {
  // TODO Auto-generated method stub]
  switch (item.getItemId()) {
  case MENU_ADD: // 추가 버튼

...
   case MENU_SERVERADD:
   AlertDialog.Builder alertDlg = new AlertDialog.Builder(
     Paint_Book.this);
   alertDlg.setTitle("닉네임 입력");
   alertDlg.setView(linear);
   alertDlg.setCancelable(false);
   alertDlg.setPositiveButton("확인",
     new DialogInterface.OnClickListener() {
      @Override
      public void onClick(DialogInterface dialog, int which) {
       // TODO Auto-generated method stub
       dialtext = edittext.getText().toString();
       onPictureTakenserver(paintview);   //갤러리에 저장
       imageUpload(dialtext);  //사진 서버에 저장 부분
      }
     });
   alertDlg.show();
   
   break;
  case MENU_DELETE: // 추가 버튼
 ...

break;

  case MENU_EXIT:
  ...

   break;
  }
  return true;
 }

 

//서버 전송부분

void imageUpload(String dialtext) {
  String urlString = "http://192.168.153.70:8080/Animal_select_db/image_upload_test.jsp";
  String filename = dialtext + ".png";
  String fileURL = "/sdcard/" + dialtext + ".png";

  String lineEnd = "\r\n";
  String twoHyphens = "--";
  String boundary = "*****";

  try {
   FileInputStream mFileInputStream = new FileInputStream(fileURL);

   URL connectUrl = new URL("urlString);
   Log.d("Test", "mFileInputStream  is " + mFileInputStream);

   // open connection
   HttpURLConnection conn = (HttpURLConnection) connectUrl
     .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);

   // write data
   DataOutputStream dos = new DataOutputStream(conn.getOutputStream());
   dos.writeBytes(twoHyphens + boundary + lineEnd);
   dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\""
     + filename + "\"" + lineEnd);
   dos.writeBytes(lineEnd);

   int bytesAvailable = mFileInputStream.available();
   int maxBufferSize = 1024;
   int bufferSize = Math.min(bytesAvailable, maxBufferSize);

   byte[] buffer = new byte[bufferSize];
   int bytesRead = mFileInputStream.read(buffer, 0, bufferSize);

   Log.d("Test", "image byte is " + bytesRead);

   // read image
   while (bytesRead > 0) {
    dos.write(buffer, 0, bufferSize);
    bytesAvailable = mFileInputStream.available();
    bufferSize = Math.min(bytesAvailable, maxBufferSize);
    bytesRead = mFileInputStream.read(buffer, 0, bufferSize);
   }

   dos.writeBytes(lineEnd);
   dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);

   // close streams
   Log.e("Test", "File is written");
   mFileInputStream.close();
   dos.flush(); // finish upload...

   // get response
   int ch;
   InputStream is = conn.getInputStream();
   StringBuffer b = new StringBuffer();
   while ((ch = is.read()) != -1) {
    b.append((char) ch);
   }
   String s = b.toString();
   Log.e("Test", "result = " + s);
   dos.close();

  } catch (Exception e) {
   Log.d("Test", "exception " + e.getMessage());
   // TODO: handle exception
  }
 }

이렇게 다이얼로그에서 텍스트입력받고  그텍스트로  onPictureTakenserver(paintview) 메서드를 이용해서 png파일로 sdcard에 저장한후 바로 업로드 메서드   imageUpload(dialtext);  를 호출시켜서 방금만들어진 png파일을 업로드하려고하는데 안되네용...이렇게 바로 업로드 메서드를 호출시키지 않고 따로 서버에 전송하면 잘되는데말이죠..이런식으로는 방법이 없는걸까요??