| | |
| | | MultipartFile file = multipartRequest.getFile(fileNames.next()); |
| | | String fileName = file.getOriginalFilename(); |
| | | String suffix = fileName.substring(fileName.lastIndexOf(".")); |
| | | if ( !StringUtils.equalsIgnoreCase(suffix, ".jpg") || !StringUtils.equalsIgnoreCase(suffix, ".png")) { |
| | | if ( !StringUtils.equalsIgnoreCase(suffix, ".jpg") && !StringUtils.equalsIgnoreCase(suffix, ".png")) { |
| | | context.put("code", 0); |
| | | context.put("message", "对不起,文件格式上传有误!"); |
| | | return; |
| | | } |
| | | } |
| | | upload(multipartRequest, response, folder + "/", |
| | |
| | | } |
| | | String nowDate = DateUtil.getNowShortDate();// 当前时间(年月日) |
| | | String fileName = UUID.randomUUID().toString() + nfix; |
| | | String tempFileName = nowDate + "/" + fileName; |
| | | String tempFileName = nowDate + "/" + fileName; |
| | | String key = folder + tempFileName;// 文件名 |
| | | ALiYunUtil obs = new ALiYunUtil(endpoint,access_id, access_key); |
| | | if (obs.uploadOnlineObject(file.getInputStream(),bucketName, key,null)) { |