If you have access to the server side, I advise to debug the upload process. The exception suggests that you want to open the file on the server based on the uploaded file name. On your local machine this works, because it runs on the same file system. On the server side, the Apache FileUpload receives binary data, which needs to be extracted from the request data stream:
@Override
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
if (ServletFileUpload.isMultipartContent(request)) {
FileItemFactory factory = new DiskFileItemFactory(Integer.MAX_VALUE, null);
ServletFileUpload upload = new ServletFileUpload(factory);
List items = upload.parseRequest(request);
for (FileItem item : items) {
byte[] data = item.get();
// do something with the binary data
}
} else {
System.err.println("Not a multipart/form-data");
}
}
And also you need the form to be:
<form name='frm' method="POST" action='UploadServlet'
id="frm" enctype="multipart/form-data">