Hi DennisG:
I copy sources into my project. I can see three package in the src folder.
Is it right?
When I keyin"HttpClient client = new DefaultHttpClient();",it had error.
I fix this error by "import org.apache.http.client.HttpClient;"
Is it right?
I saw all java code in the 2 packages that copy from
"httpcomponents-client-4.2.1",I can not find reference java file name.
For example: I can see the FileBody.java. You want us to use it replaceing
httpmime.jar,right?
Now I didn't work.
Could you give me some suggestion?Thanks a lot
My post with file code as below
private class SubThread implements Runnable
{
public void run() //實作Runnable介面的類別(class),唯一的要求就是要實作run()方法(method)
{
File file = new File("/sdcard/android.jpg");
try {
HttpClient client = new DefaultHttpClient();
String postURL = "
http://latest.tsd2497r1.ext.hipaas.hinet.net/upload.php";
HttpPost post = new HttpPost(postURL);
FileBody bin = new FileBody(file);
MultipartEntity reqEntity = new
MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
reqEntity.addPart("myFile", bin);
post.setEntity(reqEntity);
HttpResponse response = client.execute(post);
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
Log.i("RESPONSE",EntityUtils.toString(resEntity));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
DennisG於 2012年5月7日星期一UTC+8上午3時52分17秒寫道:
> Yes, you should copy sources into yourproject/src folder. The final
> directiry structure should be like
> yourproject/src/org/apache/http/entity/mime/...
>
> You should not mix jar libraries and sources files these libraries created
> from.
>
> Everythihng works fine for me, so just do it carefully.
>
> On Friday, May 4, 2012 6:03:56 PM UTC+3, blackrat wrote:
>>
>> Um, sorry, i tried to put all the stuffs in src into src of my project
>> but it did not work T_T
>> just to make sure, this is the tree: myprojectname/src/
>> theStuffsThatNeedToBeCopy
>>
>> I download this: httpcomponents-client-4.1.3 , go into the src folder
>> and do da stuff you said but no good.
>> I also add several external jars such as httpmine-4.1.3jars and stuffs
>> but still doesn't work. Pliz help!!!
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en