原上传文件上传成功后.apk格式就变成.vnd.android.package-archive 原上传:
@PostMapping("/upload")
public AjaxResult uploadFile(MultipartFile file) throws IOException {
if (!file.isEmpty()) {
if (file != null && file.getOriginalFilename() != null) {
String contentType = file.getContentType();
String ext = contentType.substring(contentType.lastIndexOf("/") + 1, contentType.length());
FileDTO input = new FileDTO();
input.setName(file.getOriginalFilename());
input.setStream(file.getInputStream());
input.setExt(ext);
String url = UploadFactory.uploadFile(input,"file");
AjaxResult ajax = AjaxResult.success();
ajax.put("url", url);
return ajax;
}
}
return AjaxResult.error("上传图片异常,请联系管理员");
}
新上传:
@PostMapping("/apk/upload")
public AjaxResult uploadApkFile(MultipartFile file) throws IOException {
if (!file.isEmpty()) {
if (file != null && file.getOriginalFilename() != null) {
String contentType = file.getOriginalFilename();
String ext = contentType.substring(contentType.lastIndexOf(".") + 1, contentType.length());
FileDTO input = new FileDTO();
input.setName(file.getOriginalFilename());
input.setStream(file.getInputStream());
input.setExt(ext);
String url = UploadFactory.uploadFile(input,"apk");
AjaxResult ajax = AjaxResult.success();
ajax.put("url", url);
return ajax;
}
}
return AjaxResult.error("上传图片异常,请联系管理员");
}
|