Hello Everyone,
I'm trying to write a
servlet that takes a file uploaded by a user from a website, and then passes that file to another
java class that's going to do lots of fun stuff with it.
All the explanations I could find for handling uploaded files talked about using the FileUpload libraries from Apache Commons. However, using that, I wind up with FileItems, not files. My java program takes a File as an argument. I tried to cast the FileItem to a File, but then I get this error from
Tomcat when I tried to submit the form:
Here's my servlet:
All I want to do is have the servlet pass the file to the java model class. The examples I found online of creating a List of FileItems seems incredibly complicated, is there an easier way I can do this?
Thanks!
Matt