Another option is to use the other part of the oreilly package.
There is a mutlipart parser, that you can use without having to specify an upload directory. This way you can retrieve the upload directory, and then when it parses the file, you can save to that directory.
I've never used it, as it looked more complicated. I just checked the site out to confirm what I said, and here is a snip from their FAQ (it makes the most sense, as I hadn't thought of the order not being guaranteed)...
*** Here is the quote ***
How can I select a directory for the uploaded files based on some information sent in the upload request?
Again, the protocol doesn't make this easy. In fact, there's no guarantee the browser will send the parameter information before the files. The safest approach is to create a temporary directory, upload the files into there, then after the upload move the files and/or the directory into the proper location.
** End Quote **
This seems a pretty good way to accomplish what you're after. In fact, it's how I've already coded a servlet.
[This message has been edited by Mike Curwen (edited September 21, 2001).]