File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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: 42965
No. The client can't access the file system of the server.
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: 13037
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.

I agree. Here's the link:
subject: File dialog to display server file system
It's not a secret anymore!