File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "File dialog to display server file system" Watch "File dialog to display server file system" New topic
Author

File dialog to display server file system

SaiLaxmi Korada
Greenhorn

Joined: Oct 25, 2007
Posts: 2
Hi,

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?

Thanks
Ulf Dittmer
Marshal

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


Ping & DNS - my free Android networking tools app
Ben Souther
Sheriff

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.io.File.


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
Rancher

Joined: Mar 22, 2000
Posts: 12760
    
    5
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.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
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