wood burning stoves 2.0*
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 Murach's Java Servlets and JSP this week in the Servlets 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: 6661

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: 15952

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.
I agree. Here's the link: http://aspose.com/file-tools
subject: Uploading a directory using JSP/JSF
Similar Threads
categorize data display
Which version of J2ee should be used for JSF?
get directory name from the local file system
java.lang.RuntimeException: FacesContext not found