且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将图片从Android Java应用程序上传到Codeigniter

更新时间:2022-11-05 13:43:57

答案在Java代码中.我需要添加的其他一些参数到文件正文中.

The answer was in the java-code. What I needed to add was some more parameters to the filebody.

  multipartContent.addPart("userfile", new FileBody(new File(filename), filename, "image/jpeg", "utf-8"));

这完美无瑕. 您可以在以下位置找到有关文件主体构造函数的信息:

This works flawlessly. Information about the filebody constructor you can find here: http://hc.apache.org/httpcomponents-client-ga/httpmime/apidocs/org/apache/http/entity/mime/content/FileBody.html