• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

File upload in jsf

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am just struggling with a question, that is i want to upload a file via browse option, in that case in html we will use <input type="file" name="upload"> it's fine , Similarly is any tag is available in JSF to choose file with it's whole path

I am looking for answer for this, if you do, you will be really appreciated
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

There isn't a tag for file upload. Yet there are open libraries like tomahawk (the t:inputFileUpload) or primeface (p:fileUpload). IF you use RichFaces or ICEFaces maybe they have similar tags too.
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Tsang said, there is no support for fileupload via a core JSF tag, although many of the third-party extension tagsets have some sort of fileupload control.

As far as getting the option to "choose file with it's whole path" goes, that depends on what you mean. I don't think that you can make the server pre-select the user's source directory in the fileupload dialog for the simple reason that there is no way for the server to deduce the remote user's file system organization to know what directories are available and where. I don't even have a "C:" drive, for example.

If you are referring to having the entire client filesystem path get set to the server by the client application (browser) as part of an upload submit, that is a feature of Internet Explorer. Many other browsers and OS's only send the basic filename without directory information. Which is more secure, as an unscrupulous web application could learn things about a client's disk layout that could be exploited. Then again, IE didn't exactly win many awards for making hard to attack other people's computers.
 
karmegam shiva
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@ holloway

Thanks for your valuable points, i got some idea in that,

The problem of mine is , i need to verify the path of client machine , so now i got a solution which is i am forcing client to enter the file name path in Text field rather than via browse option , so i can get the value of Text field easily.



Thanks

Regards
karmega siva
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As I said, however, informing the server about the directory structure of a client machine is a security problem, and many web browsers will not provide it. IE is an exception. IE is not as popular as it used to be, and I cannot even confirm that all versions of IE will pass the directory pathname, since, as I said, that's revealing sensitive information about the client.
 
reply
    Bookmark Topic Watch Topic
  • New Topic