how post file and string for HttpClient?
I use blow codes,post file and string ,but response error code 500.
Uri.Builder builder = new Uri.Builder();
builder.path(AIRQ_POST_AIRQ);
HttpPost post = new HttpPost(builder.build().toString());
FileEntity imageEntity=new FileEntity(null,"multipart/form-data");
StringEntity msgEntity = new StringEntity(msg,CharEncoding.UTF_8);
StringEntity latEntity = new StringEntity(""+lat,CharEncoding.UTF_8);
StringEntity lonEntity = new StringEntity(""+lon,CharEncoding.UTF_8);
StringEntity typeEntity = new StringEntity(""+type,CharEncoding.UTF_8);
StringEntity tagidEntity = new StringEntity(""+tagid,CharEncoding.UTF_8);
StringEntity sourceEntit开发者_开发知识库y = new StringEntity(source,CharEncoding.UTF_8);
post.setEntity(imageEntity);
post.setEntity(msgEntity);
post.setEntity(latEntity);
post.setEntity(lonEntity);
post.setEntity(typeEntity);
post.setEntity(tagidEntity);
post.setEntity(sourceEntity);
sendAirQHttpTask(post,responseHandler);
The problem is at server side. As you can see here 500
means Internal Server Error
.
精彩评论