| | |
| | | /** |
| | | * 上传文件 |
| | | */ |
| | | public <T> List<MetaFileEntity> uploadData(T t, UserEntity ue, HttpServletRequest request, HttpServletResponse res) throws Exception { |
| | | StandardMultipartHttpServletRequest req = (StandardMultipartHttpServletRequest) request; |
| | | public <T> List<MetaFileEntity> uploadData(T t, String path, HttpServletRequest req, HttpServletResponse res) throws Exception { |
| | | StandardMultipartHttpServletRequest request = (StandardMultipartHttpServletRequest) req; |
| | | req.setCharacterEncoding("utf-8"); |
| | | res.setContentType("application/json;charset=utf-8"); |
| | | |
| | | if (t != null) { |
| | | setEntity(t, req); |
| | | setEntity(t, request); |
| | | } |
| | | List<MetaFileEntity> list = getFiles(req); |
| | | List<MetaFileEntity> list = getFiles(path,request); |
| | | |
| | | return list; |
| | | } |
| | |
| | | /** |
| | | * 获取文件 |
| | | */ |
| | | private List<MetaFileEntity> getFiles(StandardMultipartHttpServletRequest req) throws Exception { |
| | | private List<MetaFileEntity> getFiles(String subPath,StandardMultipartHttpServletRequest req) throws Exception { |
| | | List<MetaFileEntity> list = new ArrayList<MetaFileEntity>(); |
| | | |
| | | String path = pathHelper.getTempPath(); |
| | | String path = pathHelper.getTempPath(subPath); |
| | | Iterator<String> iterator = req.getFileNames(); |
| | | while (iterator.hasNext()) { |
| | | MultipartFile file = req.getFile(iterator.next()); |