별의 별 방법으로 다 해봐도 웹서버는 요지 부동입니다.

이미지를 전송하는데 405 에러가 자꾸 발생합니다.

다른 곳에서도 안되면 뭐라 못하겠는데 옴니아2에서 C#으로 개발한 http 이미지 전송은

동일서버에서 잘 됩니다.

웹서버는 windows2003 iis서버입니다.

여러가지 방법을 다 써서 해봐도 안드로이드에서는 405 에러가 나네요.. 애뮬도 그렇고 단말기도 그렇고

아래는 제가 최종으로 써본 소스 입니다. 이방법 말고도 httppost방법 등등 여러가지 해봐도 동일합니다.

서버 셋팅의 문제인지 소스상의 문제인지 알고 싶습니다.

이 소스는 다른분은 전송이 성공했다는 소스인데 저는 왜 안되는지 모르겠네요.. 

여러분의 고견 부탁드립니다.  일주일째 삽질중입니다.. ㅠㅠ

 String tag;
 boolean inTitle = false;
 int imgCount = 0;
 URLConnection con = null;
 DataOutputStream dos;
 String lineEnd = "\r\n";
 String twoHyphens = "--";
 sFileName = "capture.jpg";

 String boundary = "*****";

 File getCurrentDir = getFilesDir();
 File file = new File(getCurrentDir, sFileName);
                                 
 FileInputStream fileInputStream  = new FileInputStream(file);
                                 
 URL url = new URL("http://forest.kworks.co.kr/camera");
 conn = (HttpURLConnection) url.openConnection();

  // Allow Inputs
 conn.setDoInput(true);

 // Allow Outputs
 conn.setDoOutput(true);

 // Don't use a cached copy.
 conn.setUseCaches(false);

 // Use a post method.
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=\"" + "aaa.jpg" +"\"" + lineEnd);
dos.writeBytes(lineEnd);
                                     
int maxBufferSize=1024;
int bytesAvailable = fileInputStream.available();
int bufferSize = Math.min(bytesAvailable, maxBufferSize);
byte[] buffer = new byte[bufferSize];

// read file and write it into form...

 int bytesRead = fileInputStream.read(buffer, 0, bufferSize);

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

// send multipart form data necesssary after file data...

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

// close streams
//   Log.e(Tag,"File is written");
fileInputStream.close();
dos.flush();
dos.close();

String a = conn.getResponseMessage(); //여기서 405에러가 리턴됩니다.
System.out.println(a);
conn.disconnect();