2012-07-21 3 views
1
I would like to upload a name.txt file without ussing MultiEntitiy "importing a large file" as my file is small in size... I have written the following code but unable to upload a file.. thanks for your concern... 

URL url = new URL(strUrl); 
    HttpURLConnection conn = (HttpURLConnection) url.openConnection(); 
    conn.setDoInput(true); // Allow Inputs 
    conn.setDoOutput(true); // Allow Outputs 
    conn.setUseCaches(false); // Don't use a Cached Copy 
    conn.setRequestMethod("POST"); 
    conn.setRequestProperty("userfile", strEmailAddress + ".txt"); 
    dos = new DataOutputStream(conn.getOutputStream()); 
    dos.writeBytes("Content-Disposition: form-data; name=\"paramName\""); 
    Helper.printLogD(" connection " + conn.getContent().toString()); 

String temp = getStringFromInputStream(conn.getInputStream()); 
Helper.printLogI("temp" + temp); 
+1

질문을 다시 말하십시오. 당신은 * 질문을 추가하는 것을 잊었다 * – adatapost

+0

나는 파일이나 이미지를 업로드 할 때 경계를 추가해야한다고 생각한다. – Anand

+0

질문이 질문을 묻는 질문을 한 날이 있습니다 :-) –

답변

1

에 HttpPost 사용하여 파일을 업로드해야합니다.

희망 하시겠습니까?

관련 문제