• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Selecting a directory instead a file

 
Anutosh Swamy
Ranch Hand
Posts: 30
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We all know to uplaod a file we use the input element of HTML with the type attribute set to "file" and we have to select a file, but I want to select just the directory (may be empty directoy) as a path to send it to the server.

Can any one help me to achieve this in HTML

I don't want the user to select a dummy file from the directory (chosen one) and to do some server side processing to remove the file and retrieve the path.

Thanks in advance.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34870
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anutosh,
You mean you want send a String containing the name of the path? How about providing an input element where the user can type it in?
 
Anutosh Swamy
Ranch Hand
Posts: 30
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jeanne,

That's true I can provide an input text where the user can type the path, if the path is small that is fine but what if the path is too long (the desired location for the user to save a file) than it will not be a user friendly GUI so I need to make the user choose it dynamically like the way we choose the path to save a newly created notepad or a MS-word file, like this.

Any suggestions?
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The input file control only allows you to select a file. Also most browsers will not send up the file path with that control either.

Eric
 
Anutosh Swamy
Ranch Hand
Posts: 30
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way at all so that I can achive what I want to have on my web page?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65129
92
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. not with HTML.

Maybe with an applet? ActiveX control (shudder)?
[ September 18, 2008: Message edited by: Bear Bibeault ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34870
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anutosh Swamy:
Any suggestions?

A prompt to suggesting copy/pasting the path in?

Out of curiosity, what are you doing with the path later? You can't read from the directory without informing the user anyway. Which implies it is just text in some forum.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic