Win a copy of Java Challengers this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Select Directory

 
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Anyone know how to either in html or in JSP how to select a directory,

what i'm trying to do is to let the user press a button a web page and a pop-up dialog comes up where the user can select a directory to upload files from,

Any ideas - Thanks in advance,

Niall
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The file which suer is going to uplaod will be uploaded at server. right??

If yes then how can a user who is browsing can access your server or so...I

guess you should handle this directory oath from backend...
 
Marshal
Posts: 26531
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a little HTML form that allows the user to select a file and upload it:This takes care of allowing a user to select a file from any directory. If you've ever attached a file to an e-mail in Hotmail or any other web e-mail program, they all use something like this only prettier.
 
Niall Loughnane
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the sample code

but

what im trying to do is to let the user press a button, perhaps "select directory", and a pop up screen comes up and the user can select a directory where there are multiple files that the user wants to upload,

the html code is brilliant for a single file but what happens if there is multiple files in a directory that the user wants to upload?

Thanks in advance
 
Paul Clapham
Marshal
Posts: 26531
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The user can only upload one file per "input type=file" element. You could provide four of them, then the user could upload four files. HTML doesn't have anything fancy like what you are proposing.
 
Niall Loughnane
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sound Paul

but is it possible by JSP?
 
Paul Clapham
Marshal
Posts: 26531
81
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All the browser sees is HTML. It makes no difference whether you use JSP or something else to generate that HTML.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is possible to write this yourself using Javascript on the client and Java on the server. For the client, use Javascript to create your popup.

For the server side of things, look at the java.io.File class to learn how to read directory structures from within Java.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic