• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File dialog to display server file system

 
SaiLaxmi Korada
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. The client can't access the file system of the server.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic