You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Frank <fh...@gmail.com> on 2009/08/24 06:08:27 UTC

[Trinidad] Accessing uploaded files

Hi:

I am sending a multi-part post request via HttpClient to Trinidad.  I want
to access the uploaded file on the server side.  Basically, I can't really
use the file upload sample from developer guide
http://myfaces.apache.org/trinidad/devguide/fileUpload.html because I am not
using an inputfile and value change listener, rather I constructed the
multi-part request using HttpClient.

I need to access the uploaded file that has been processed by Trinidad, I
didnt' find any documentation, therefore I had dig through "trinidad
internal" source code.  The only way I can do this is by the following code:

Map<String, Object> requestMap = fctx.getExternalContext().getRequestMap();
UploadedFiles uploadedFiles =
(UploadedFiles)requestMap.get("org.apache.myfaces.trinidadinternal.webapp.UploadedFiles");
UploadedFile file = uploadedFiles.getUploadedFile("fileName");

Is there a better way to do retrieve the uploaded file??

Thanks

Frank