/**
* 这个方法是上传文件的入口点,因为我的业务逻辑需要把文件上传到FTP上,所以你直接用我的类可能有几个参数未定义,
* 你主要是理解这个上传方法的业务逻辑,你只需要获取到上传流传递到上传线程类中处理即可
* 2014-4-22
*/
public void uploadingTest111(HttpServletRequest request,
HttpServletResponse response, HttpSession session)
throws IOException {
ExecutorService es = Executors.newCachedThreadPool();
Collection co = new ArrayList();
List picsList = new ArrayList();
try {
DiskFileItemFactory dfif = new DiskFileItemFactory();
ServletFileUpload sfu = new ServletFileUpload(dfif);
List items = sfu.parseRequest(request);
Iterator it = items.iterator();
while (it.hasNext()) {
FileItem fileItem = (FileItem) it.next();
if (fileItem.getName() != null) {
InputStream is = fileItem.getInputStream();//你需要从request中获取到输入流再操作
OutputStream fos = ******;//获得输出流d的操作
UploadCallable uc = new UploadCallable(is, fos, tc);
co.add(uc);
}
}
es.invokeAll(co);
} catch (Exception e) {
e.printStackTrace();
}
}
字数超限制了,你追问我,我再把线程类贴给你看看。