This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes JSP and the fly likes Uploading a directory using JSP/JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Uploading a directory using JSP/JSF" Watch "Uploading a directory using JSP/JSF" New topic

Uploading a directory using JSP/JSF

rajshkhr pandey
Ranch Hand

Joined: Oct 14, 2009
Posts: 35
Hello to all,

I want to upload a directory to the server using jsp/jsf component. So, how can I browse to the directory?

Thanks in advance.
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

The contents of the directory or the directory alone ?

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
rajshkhr pandey
Ranch Hand

Joined: Oct 14, 2009
Posts: 35
Deepak Bala wrote:The contents of the directory or the directory alone ?

I want to upload the content of the directory with directory.
Suppose there are 20 files in the directory, I want to upload the those 20 file.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16473

Uploading the directory isn't the problem. Selecting all the files in the directory is. I'm using a RichFaces JSF control to do multi-file uploads, but the user has to select each file individually.

Manual file selection is mandated because making it too automatic would permit people to design malware that bulk-uploaded files with sensitive information in them. The only way I can think of to get around this would be to initiate the uploaded from JavaScript, but JavaScript's sandbox may not permit selection without user interaction for the reason I just gave.

Actually, there's one way that definitely would work, and that's to run a true client-side application such as a Java applet. But in order to make the applet capable of uploading, you'd have to digitally sign it, since unsigned applets aren't allowed to access the user's local filesystem. And getting signed applets accepted by the user's browser is more pain than casual Internet users are generally willing to put up with.

Customer surveys are for companies who didn't pay proper attention to begin with.
It is sorta covered in the JavaRanch Style Guide.
subject: Uploading a directory using JSP/JSF