blueimp/jQuery-File-Upload — Issue #708: How can I upload the form through JSP?
Author: nipsccafe
Created: 2011-10-17 07:59:57+00:00
State: open

Hi. I am begin to study JSP & J-query and find difficulty to setup the "upload plugin" in my web site.
(I don't use auto upload)
And I want to use two upload plugins and send the form with some description at once.
but when I test this, file can't be uploaded.

index.html
========================================================

Add files...

... ...

==========================================================

and the form is sent to the 'test.jsp" <- This source also i got from Internet...
===========================================================
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
<%@ page import="com.oreilly.servlet.MultipartRequest" %>
<%@ page import="com.oreilly.servlet.multipart.DefaultFileRenamePolicy" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.net.*" %>
<%
String realPath = "";
String savePath = "/upload/temp";
realPath = this.getServletContext().getRealPath(savePath);
ArrayList saveFiles = new ArrayList();
ArrayList origFiles = new ArrayList();
try{
MultipartRequest multi = new MultipartRequest(request, realPath, maxSize, charset, new DefaultFileRenamePolicy());
//String fileName= multi.getFilesystemName("Filename");
//String originFileName = multi.getOriginalFileName("Filename");
categoryname = multi.getParameter("categoryname");
title = multi.getParameter("title");
description = multi.getParameter("description");
emply_nm = multi.getParameter("emply_nm");

Enumeration files = multi.getFileNames();
while(files.hasMoreElements()){
String name = files.nextElement();
saveFiles.add(multi.getFilesystemName(name));
origFiles.add(multi.getOriginalFileName(name));
}
%>
================================================================================

I can get other parameters but files...
When I check it... I could see only "null" message.

Do I have to also use JSON just for uploading? If so, please tell me how can i implement this.