This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JSP and the fly likes File dialog to display server file system Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "File dialog to display server file system" Watch "File dialog to display server file system" New topic

File dialog to display server file system

SaiLaxmi Korada

Joined: Oct 25, 2007
Posts: 2

This is an urgent requirement. When we click on browse button ("input type="file" value="Browse"), by default it pops-up File upload dialog of the local machine. But our requirement is, when we click on browse button, it should open the file system of server(which is in the same network), and allow us to navigate the directory structure and download file from there. Is it possible to do this in JSP?

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 39530
No. The client can't access the file system of the server.

Ping & DNS - updated with new look and Ping home screen widget
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

First, please see
EaseUp to find out why adding 'urgent' to your posts or subject line can actually slow down or halt responses to your question altogether.

As Ulf mentioned, a browser can't, by default, see the file structure on your server. Picture the security nightmaares we'd all have to deal with if they could.

There is nothing stopping you, however, from writing a servlet that reads the file system on the server and presents it as HTML to the browser.
Look at

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12671
Naturally you should not try to write this function as JSP scriptlets - it is an ideal job for a "bean" style helper class. Remember to provide for configuration of restrictions on the parts of the file system the user is allowed to browse to.


Java Resources at
I agree. Here's the link:
subject: File dialog to display server file system
Similar Threads
html:file , setting default file type for choosing
input type=file question
Getting the "Tree View" Dialog Box
Need Help for implementing save as dialog box for downloading a folder not a file
Renamae browse button of inputFile