// Path: tianti-common/src/main/java/com/jeff/tianti/common/dto/AjaxResult.java
// public class AjaxResult {
// 
// 	private boolean success;
// 
// 	private String msg;
// 
// 	private Object data;
// 
// 	public boolean isSuccess() {
// 		return success;
// 	}
// 
// 	public void setSuccess(boolean success) {
// 		this.success = success;
// 	}
// 
// 	public String getMsg() {
// 		return msg;
// 	}
// 
// 	public void setMsg(String msg) {
// 		this.msg = msg;
// 	}
// 
// 	public Object getData() {
// 		return data;
// 	}
// 
// 	public void setData(Object data) {
// 		this.data = data;
// 	}
// 
// }


import java.io.File;
import java.io.PrintWriter;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.jeff.tianti.common.dto.AjaxResult;

package com.jeff.tianti.controller;





/**
 * 文件异步上传Controller
 * @author JeffXu
 * @since 2016-03-14
 */
@Controller
@RequestMapping("/upload")
public class UploadController {
	
	public final static String ATTACH_SAVE_PATH = "attach";

	@RequestMapping("/uploadAttach")
	public void uploadAttach(HttpServletRequest request, PrintWriter out) {
		MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
		Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
		MultipartFile multipartFile = null;
		String fileName = null;
		for (Map.Entry<String, MultipartFile> set : fileMap.entrySet()) {
			multipartFile = set.getValue();// 文件名
		}
		fileName = this.storeIOc(multipartRequest, multipartFile);

		out.print(fileName);
	}


	@RequestMapping("/ajax/upload_file")
	@ResponseBody

// Path: tianti-common/src/main/java/com/jeff/tianti/common/dto/AjaxResult.java
// public class AjaxResult {
// 
// 	private boolean success;
// 
// 	private String msg;
// 
// 	private Object data;
// 
// 	public boolean isSuccess() {
// 		return success;
// 	}
// 
// 	public void setSuccess(boolean success) {
// 		this.success = success;
// 	}
// 
// 	public String getMsg() {
// 		return msg;
// 	}
// 
// 	public void setMsg(String msg) {
// 		this.msg = msg;
// 	}
// 
// 	public Object getData() {
// 		return data;
// 	}
// 
// 	public void setData(Object data) {
// 		this.data = data;
// 	}
// 
// }


// Path: tianti-modules/tianti-module-admin/src/main/java/com/jeff/tianti/controller/UploadController.java
import java.io.File;
import java.io.PrintWriter;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.jeff.tianti.common.dto.AjaxResult;

package com.jeff.tianti.controller;





/**
 * 文件异步上传Controller
 * @author JeffXu
 * @since 2016-03-14
 */
@Controller
@RequestMapping("/upload")
public class UploadController {
	
	public final static String ATTACH_SAVE_PATH = "attach";

	@RequestMapping("/uploadAttach")
	public void uploadAttach(HttpServletRequest request, PrintWriter out) {
		MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
		Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
		MultipartFile multipartFile = null;
		String fileName = null;
		for (Map.Entry<String, MultipartFile> set : fileMap.entrySet()) {
			multipartFile = set.getValue();// 文件名
		}
		fileName = this.storeIOc(multipartRequest, multipartFile);

		out.print(fileName);
	}


	@RequestMapping("/ajax/upload_file")
	@ResponseBody

	public AjaxResult ajaxUploadFile(HttpServletRequest request) {
