请给出一个SpringMVC文件上传的SmartUpload版例子

3.文件上传

例3.1:

<%@ page contentType="text/html; charset=GBK" %>
<html>
<body>
<h1>
<%
if(request.getParameter("i")!=null)
{
out.print("上传了"+request.getParameter("i")+"个文件");
}
%>
</h1>
we must use post, otheriwse, report negativeArray error.
<form method="post" action="uploadF.do" enctype="multipart/form-data">
<br>
<input  type="text" name="user" value="可以中文"/>
<!--the following name does not matter.-->
<input  type="file" name="upload"/>
<input  type="file" name="upload1"/>
<br>
<input type="submit" name="Submit" value="Submit">
<input type="reset" value="Reset">
</form>
</body>
</html>



package com;
import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.context.ServletConfigAware;
import org.springframework.web.context.ServletContextAware;
import org.springframework.web.context.support.WebApplicationContextUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.support.RequestContextUtils;

import com.jspsmart.upload.File;
import com.jspsmart.upload.Files;
import com.jspsmart.upload.SmartUpload;
import com.jspsmart.upload.SmartUploadException;

版权保护,原文出处:http://www.mark-to-win.com/index.html?content=Frame/frameUrl.html&chapter=Frame/SpringMVC_web.html#SpringMVCUpload

猜你喜欢

转载自blog.csdn.net/mark_to_win/article/details/88695509
今日推荐