1
我如何使用排球库从移动设备发送文件(数据)到服务器。如何在android中将文件上传到服务器?
这里我列出了我的参数,请帮我解决这个问题。
Map<String, String> mHeaderPart= new HashMap<>();
mHeaderPart.put("Content-type", "multipart/form-data;");
mHeaderPart.put("Authorization", authorizationKey);
//String part
Map<String, String> mStringPart= new HashMap<>();
mStringPart.put("candidate_id", SessionStores.getBullHornId(getActivity()));
mStringPart.put("externalID", "portpolio");
mStringPart.put("fileCount", "2");//number of files
mStringPart.put("fileType", "SAMPLE");
mStringPart.put("platform", "android");
//file param
Map<String, File> mFilePartData= new HashMap<>();
在上面的文件参数中,我必须添加n个文件并将其发送到服务器。我如何从设备获取文件,并添加n个文件与param并将其发送到服务器,如果有人可以请给我建议。
如果有人有使用抽球发送多个文件与param的例子,请指导我。提前致谢。
可能重复[如何使用Volley库上传图像?](http://stackoverflow.com/questions/27112694/how-to-do-upload-image -with-volley-library) – Nitesh
结帐例如[Stackoverflow Link](http:// stackoverfl ow.com/questions/16797468/how-to-send-a-multipart-form-data-post-in-android-with-volley)(http://stackoverflow.com/questions/32262829/how -to-upload-file-using-volley-library-in-android) – mpals
感谢您的回复@Nitesh,mplas。我怀疑如何发送filecontent参数作为一个数组发送多个文件。像filecontent0,filecontent1 /这里filecontent是文件参数添加文件。 – karthik