public void onClick(View v) {
// TODO Auto-generated method stub
AlertDialog.Builder dlg = new AlertDialog.Builder(
HCameraActivity.this);
dlg.setTitle("사진을 서버에 전송하시겠습니까?");
dlg.setPositiveButton("확인",
new DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog,
int which) {
new MyAsyncTask().execute();
}
});

dlg.setNegativeButton("취소",
new DialogInterface.OnClickListener() {

public void onClick(DialogInterface dialog,
int which) {
}
});
dlg.show();


public class MyAsyncTask extends AsyncTask<Void, Void, Void> {

@Override
protected void onPostExecute(Void result) {
// TODO Auto-generated method stub
Toast.makeText(getApplicationContext(), "전송 완료", Toast.LENGTH_SHORT).show();
super.onPostExecute(result);
}

@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
//Toast.makeText(getApplicationContext(), "로딩1111", Toast.LENGTH_SHORT).show();
super.onPreExecute();
}

protected Void doInBackground(Void... params) {
// TODO Auto-generated method stub
try {
URL url = new URL("
"http://wishary.wowip.kr/WeCloude/Upload.php");
Log.i("CJM", "115352541312323");
String boundary = "21312425987239857";
URLConnection con = url.openConnection();
con.setDoOutput(true);
con.setDoInput(true);
//con.setRequestMethod("POST");
con.setRequestProperty("Connection", "Keep-Alive");
con.setRequestProperty("Content-Type", "multipart/form-data; boundary="
+ boundary);
DataOutputStream wr = new DataOutputStream(con.getOutputStream());
Log.i("CJM", "111111111");
//wr.writeBytes("\r\n--" + boundary + "\r\n");
//wr.writeBytes("Content-Disposition: form-data; name=\"no\"\r\n\r\n"
// + "1");
//wr.writeBytes("\r\n--" + boundary + "\r\n");
//wr.writeBytes("Content-Disposition: form-data; name=\"table_name\"\r\n\r\n"
// + "jm");
Log.i("CJM", "22222222");
wr.writeBytes("\r\n--" + boundary + "\r\n");
wr.writeBytes("Content-Disposition: form-data; name=\"upload\"; filename=\"image.jpg\"\r\n");
wr.writeBytes("Content-Type: application/octet-stream\r\n\r\n");
FileInputStream fileInputStream = new FileInputStream(
Environment.getExternalStorageDirectory().getAbsolutePath() + "/DCIM/CJM/"+ Filename);
Log.i("CJM", "3333333");
int bytesAvailable = fileInputStream
.available();
int maxBufferSize = 1024;
int bufferSize = Math.min(bytesAvailable,
maxBufferSize);
byte[] buffer = new byte[bufferSize];

int bytesRead = fileInputStream.read(
buffer, 0, bufferSize);
Log.i("CJM", "444444");
while (bytesRead > 0) {
// Upload file part(s)
DataOutputStream dataWrite = new DataOutputStream(
con.getOutputStream());
dataWrite.write(buffer, 0, bufferSize);
bytesAvailable = fileInputStream
.available();
bufferSize = Math.min(bytesAvailable,
maxBufferSize);
bytesRead = fileInputStream.read(
buffer, 0, bufferSize);
}
fileInputStream.close();
wr.writeBytes("\r\n--" + boundary + "--\r\n");
wr.flush();
Log.i("CJM", "sd");

} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.i("CJM", "55555");

return null;
}
안녕하십니까 선배 여러분 ㅠㅠ 이미지 서버로 업로드하는 것을 연습하고있는데
열심히 구글링도해보고 찾아봐도 도저히 문제를 모르겠습니다. 로그도 다 찍히고 경로도 맞는것 같은데
이미지가 올라가지를 않습니다...... 다이얼로그창에서 확인을 누르면 저렇게 AsyncTask doinbackground 로 가는데
사실 저것도 인터넷 보면서 혼자 해본거라 제대로 쓰레드를 쓰고있는건지 모르겠습니다.
초보에게 가르침을 내려주십시오..ㅠㅠ