In the past there has been some discussion about how to upload files to the 
server.  The general solution is to use the O'Reilly servlet authored by 
Jason Hunter. That seems to work well, and it's nice of him to offer it.

I took a look at RFC 1867 describing the upload format, and found that it's 
based on MIME, just like email attachments.  As such, I thought that the 
Java Mail API (which is required to be present in a J2EE platform) could be 
used to do much of the work.  Turns out it can.  All the parsing can be 
done in essentially one line of (non-library) code!

I put together a class (200 lines, half of them comments) using this 
approach, and a demo servlet to call it.  Seems to work fine.  Even if it 
doesn't do quite want you want, you should be able to modify it easily.

Following Jason's example I'll offer it to anyone that wants it. (You don't 
even have to buy my book!)  Just drop me a line, and promise to tell me 
about any bugs you find.

Nick Newman, SCIENTECH Inc.


Reply via email to