This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan 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 Android Security Essentials Live Lessons this week in the Android 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: 41132
No. The client can't access the file system of the server.

Ping & DNS - my free Android networking tools app
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: 12761
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.

It is sorta covered in the JavaRanch Style Guide.
subject: File dialog to display server file system
Similar Threads
html:file , setting default file type for choosing
Renamae browse button of inputFile
input type=file question
Need Help for implementing save as dialog box for downloading a folder not a file
Getting the "Tree View" Dialog Box