Aaron Bartell <[EMAIL PROTECTED]> wrote:
..
> private void writeFile(UploadedFile uf, String file) throws IOException
> {
> InputStream is = uf.getInputStream();
> FileOutputStream fos = new FileOutputStream(file);
> int c;
> while ((c = is.read()) != -1) {
> fos.write(c);
> }
> }
Thanks for all the replies!
My code now looks in general like this:
MultipartRequestWrapper r =
(MultipartRequestWrapper)facesContext.getExternalContext().getRequest();
Map m = r.getFileItems();
Iterator iter = m.values().iterator();
FileItem fItem = null;
while (iter.hasNext())
{
fItem = (FileItem)iter.next();
if (!fItem.isFormField())
{
break;
}
}
if (fItem != null && !fItem.isFormField())
fItem.write(f);
I still have to look how commons-fileupload handles the temp. files, especially
when and whether they got deleted.
Michael
--