• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Selecting a directory instead a file

 
Ranch Hand
Posts: 30
Hibernate Eclipse IDE 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.
 
author & internet detective
Posts: 39343
755
Eclipse IDE VI Editor Java
  • 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
Hibernate Eclipse IDE 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?
 
author
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
Hibernate Eclipse IDE 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?
 
Sheriff
Posts: 67269
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Posts: 39343
755
Eclipse IDE VI Editor Java
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!