java ????? ???????? ????????????
???????????? ???????[ 2013/10/24 10:16:57 ] ????????
????java:
@ResponseBody
@RequestMapping(method = RequestMethod.POST?? value = "/uploadUserPic.html")
public String saveUserPic(HttpServletRequest request??
@RequestParam(value = "userPic"?? required = true) MultipartFile file)
throws Exception {
unpackCookie(request);
String fileName = null;
String realPath = com.joytrav.Constant.FILE_REAL_PATH
+ com.joytrav.Constant.USER_UPLOAD_DIR;
if (!file.isEmpty()) {
String fileType = FileUtils.getFileType(file.getOriginalFilename());
String name = RandomUtils.getRandomFileName();
fileName = name + "." + fileType;
byte[] bytes = file.getBytes();
String newFileName = realPath + File.separator + fileName;
FileOutputStream fos = new FileOutputStream(newFileName);
fos.write(bytes); // д?????
fos.close();
File newFile = new File(newFileName);
if (newFile.isFile()) {
String url = com.joytrav.Constant.FILE_DOMAIN
+ com.joytrav.Constant.USER_UPLOAD_URL + "/"
+ fileName;
return "{'url':'" + url + "'}";
}
}
return null;
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11