I'm using javazoom for uploading
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException {
PrintWriter out = null;
JOptionPane.showMessageDialog(null, "Lets do this");
try {
response.setContentType("text/html;charset=UTF-8");
try {
MultipartFormDataRequest dataRequest = new MultipartFormDataRequest(request);
//get uploaded files
Hashtable files = dataRequest.getFiles();
if (!files.isEmpty()) {
UploadFile uploadFile = (UploadFile) files.get("filename");
byte[] bytes = uploadFile.getData();
String s = new String(bytes);
the files are always coming as empty Any help please?
Hi.
I then tried doing this with Apache Commons FileUpload:
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException {
PrintWriter out = null;
try {
response.setContentType("text/html;charset=UTF-8");
//MultipartFormDataRequest dataRequest = new MultipartFormDataRequest(request);
//get uploaded files
FileItemFactory factory = new DiskFileItemFactory();
// Create a new file upload handler
ServletFileUpload upload = new ServletFileUpload(factory);
List files = null;
try {
files = upload.parseRequest(request);
} catch (FileUploadException ex) {
Logger.getLogger(ProcessUploadItem.class.getName()).log(Level.SEVERE, null, ex);
}
and it failed at files = upload.parseRequest(request);
any pointers?
sorry and thank you :)