Foros de discusión

how to get the browsed file path into JSF controller-bean class?

thumbnail
Aritra Ghosh, modificado hace 11 años.

how to get the browsed file path into JSF controller-bean class?

Junior Member Mensajes: 62 Fecha de incorporación: 8/11/11 Mensajes recientes
Hello,
I am using Icefaces fileEntry to upload file.I would like to save those browsed file to database instead of uploading them to server.So,how to get the browsed file path into JSF controller-bean class?I am using liferay 6.0.6 and Icefaces 2.Any help?
Thanks & regards,
Aritra Ghosh
thumbnail
David H Nebinger, modificado hace 11 años.

RE: how to get the browsed file path into JSF controller-bean class?

Liferay Legend Mensajes: 14915 Fecha de incorporación: 2/09/06 Mensajes recientes
Often times you cannot. The browser is not going to give you path information because that exposes too much information from the user's perspective.

All you get is the filename itself. Where you store it or how is up to you.
thumbnail
Aritra Ghosh, modificado hace 11 años.

RE: how to get the browsed file path into JSF controller-bean class?

Junior Member Mensajes: 62 Fecha de incorporación: 8/11/11 Mensajes recientes
Thanks David for your reply.So,if I want to store some file,I always need to upload it first,then to proceed further.Is it so?
thumbnail
David H Nebinger, modificado hace 11 años.

RE: how to get the browsed file path into JSF controller-bean class?

Liferay Legend Mensajes: 14915 Fecha de incorporación: 2/09/06 Mensajes recientes
No. Depends upon the framework you're using, but most of the time you'll get either a stream or the actual byte array of the upload, it's all in memory. You can push it to a file, push it to doc lib or image gallery, or store into a database.
thumbnail
Aritra Ghosh, modificado hace 11 años.

RE: how to get the browsed file path into JSF controller-bean class?

Junior Member Mensajes: 62 Fecha de incorporación: 8/11/11 Mensajes recientes
ohh..I am using icefaces 2 and using ace:fileEntry for uploading.Thus,FileEntryEvent is being used to sense the input file as
FileEntry fileEntry = (FileEntry)event.getSource();
FileEntryResults results = fileEntry.getResults();
thumbnail
Neil Griffin, modificado hace 11 años.

RE: how to get the browsed file path into JSF controller-bean class?

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
ace:fileEntry will save the file to a temporary location on the disk. After the upload finishes, you would need to call fileInfo.getFile() and then read the file and insert the bytes as a BLOB in the database.
thumbnail
Aritra Ghosh, modificado hace 11 años.

RE: how to get the browsed file path into JSF controller-bean class?

Junior Member Mensajes: 62 Fecha de incorporación: 8/11/11 Mensajes recientes
Thanks Neil for your reply.I did the same..emoticon
Sameer Srivastava, modificado hace 11 años.

RE: how to get the browsed file path into JSF controller-bean class?

New Member Mensajes: 14 Fecha de incorporación: 22/08/12 Mensajes recientes
Hello Aritra,

I am trying to do a similar but simpler thing.
The requirement is to read the file the file only and send it as part of the parameters to the web service URL.
I am unable to read the file though.
Although I could get the FileInfo for the file like file name etc. , but I am unable to read the file.
How did you manage to configure the temporary storage for the storage of file ?

Kindly share the detailed steps taken.
Thanks in advance emoticon

Regards,

sameer
thumbnail
Neil Griffin, modificado hace 11 años.

RE: how to get the browsed file path into JSF controller-bean class?

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
When you call fileInfo.getFile() does it return a valid java.io.File instance pointing to the temporary file?
Sameer Srivastava, modificado hace 11 años.

RE: how to get the browsed file path into JSF controller-bean class?

New Member Mensajes: 14 Fecha de incorporación: 22/08/12 Mensajes recientes
Neil Griffin:
When you call fileInfo.getFile() does it return a valid java.io.File instance pointing to the temporary file?



Hello Neil,

thanks for your the reply.
I have posted all the details here .

Please help me.

Regards,
Sameer
thumbnail
Neil Griffin, modificado hace 11 años.

RE: how to get the browsed file path into JSF controller-bean class?

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
Hi Sameer,

I was glad to see in the other post that you solved the problem.

Neil
Sameer Srivastava, modificado hace 11 años.

RE: how to get the browsed file path into JSF controller-bean class?

New Member Mensajes: 14 Fecha de incorporación: 22/08/12 Mensajes recientes
Hey thanks Neil emoticon