views:

25

answers:

1

I'm trying to use this fileUpload component example to work in my own project. However, whenever I upload something, it says it uploads and completes successfully, but I have no idea where on the server it's going. I use the Windows search feature to find the filename of the file I just uploaded, but it doesn't return anything.

According to this page, the file should be stored in a temp file somewhere, but a scan of the whole server (again using the Windows search program) turns up nothing. I'm using Oracle WebLogic if that helps.

How can I find out what's happening to the uploaded file?

+2  A: 

From the linked page:

FileUpload uses two init parameters which should be defined in Filter definition in web.xml:

  • createTempFiles boolean attribute which defines whether the uploaded files are stored in temporary files or available in listener just as byte[] data (false for this example).

So, the linked code example stores it in the server's memory in flavor of a byte[]. You're supposed to write it to a file yourself using FileOutputStream. If you set createTempFiles to true, then you can obtain a fullworthy java.io.File object by org.richfaces.model.UploadItem#getFile() which in turn provides methods to reveal the actual path, such as File#getAbsolutePath().

I would recommend to set it to true anyway. Large concurrent uploads from multiple users may cause OutOfMemoryExceptions otherwise. You don't want to have that in production.

BalusC
Thanks for the help!
Matt S
You're welcome.
BalusC