Selecting a directory instead of file

Reply

Join Date: Feb 2006
Posts: 18
Reputation: techkar is an unknown quantity at this point 
Solved Threads: 1
techkar's Avatar
techkar techkar is offline Offline
Newbie Poster

Selecting a directory instead of file

 
0
  #1
Jan 11th, 2007
Hi experts,

Is there any way to select a directory instead of selecting a file using the html tag "input type='file'".How it can done?
If there is any solution please let me know.

Thanks,
techkar
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Selecting a directory instead of file

 
0
  #2
Jan 11th, 2007
No. You can only select one file at a time.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 18
Reputation: techkar is an unknown quantity at this point 
Solved Threads: 1
techkar's Avatar
techkar techkar is offline Offline
Newbie Poster

Re: Selecting a directory instead of file

 
0
  #3
Jan 13th, 2007
Originally Posted by stymiee View Post
No. You can only select one file at a time.
hi John Conde,

I got a senerio, where the end users whats to select a directory(folder) to save the file they upload.As of now ,I gave a sentence like "Select a location(folder) where u want to save the file,if the folder is empty create a dummy .txt file and select that file" .
Technically what I am doing is ,retrieving the whole path selected by the user and from that extracting only the path upto the directory(folder) not the .txt file ,finally with that path I'm concardinating with the file uploaded by the user.But this should not be the case for the user to create a dummy .txt file and selecting it instead of selecting the directory(folder).Please reply me if there is any solution for this problem?

Thanks,
techkar
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 46
Reputation: Godfear1 is an unknown quantity at this point 
Solved Threads: 3
Godfear1's Avatar
Godfear1 Godfear1 is offline Offline
Unverified User

Re: Selecting a directory instead of file

 
0
  #4
Jan 13th, 2007
Originally Posted by techkar View Post
hi John Conde,

I got a senerio, where the end users whats to select a directory(folder) to save the file they upload.As of now ,I gave a sentence like "Select a location(folder) where u want to save the file,if the folder is empty create a dummy .txt file and select that file" .
Technically what I am doing is ,retrieving the whole path selected by the user and from that extracting only the path upto the directory(folder) not the .txt file ,finally with that path I'm concardinating with the file uploaded by the user.But this should not be the case for the user to create a dummy .txt file and selecting it instead of selecting the directory(folder).Please reply me if there is any solution for this problem?

Thanks,
I know what your saying. Currently there is only a file form control, not a directory form control. Solutions would be to create your own control in Java or C++ etc and have it populate your input box.
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 18
Reputation: techkar is an unknown quantity at this point 
Solved Threads: 1
techkar's Avatar
techkar techkar is offline Offline
Newbie Poster

Re: Selecting a directory instead of file

 
0
  #5
Jan 15th, 2007
Originally Posted by Godfear1 View Post
I know what your saying. Currently there is only a file form control, not a directory form control. Solutions would be to create your own control in Java or C++ etc and have it populate your input box.
hi Godfear1,

Thanks for reply,Now it is confirmed that it cannot be done by using a HTML or javascript.Let me try out something in serverside scripting languages.

Thanks,
techkar
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Selecting a directory instead of file

 
0
  #6
Jan 15th, 2007
Even using a server side sripting language, you wont be able to grab everything in a folder on a user's computer from an HTML/browser page.

Those 'input = file' forms don't give the server any filesystem access; when you press 'submit' the browser finds the file, encodes it according to the form enctype and sends it to the server as (usually) a POST request.

The only way to do it would be write a control or application FOR THE CLIENT'S browser or computer, which they would then have to accept and install.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 18
Reputation: techkar is an unknown quantity at this point 
Solved Threads: 1
techkar's Avatar
techkar techkar is offline Offline
Newbie Poster

Re: Selecting a directory instead of file

 
0
  #7
Jan 16th, 2007
Originally Posted by MattEvans View Post
Even using a server side sripting language, you wont be able to grab everything in a folder on a user's computer from an HTML/browser page.

Those 'input = file' forms don't give the server any filesystem access; when you press 'submit' the browser finds the file, encodes it according to the form enctype and sends it to the server as (usually) a POST request.

The only way to do it would be write a control or application FOR THE CLIENT'S browser or computer, which they would then have to accept and install.
Yes you are correct, but my requirement is ,
1) In an html form I'm getting the local hard drive location in one field
2) In other field getting the name of the file
once the users submits the form.It creates an Excel sheet from the database and store it the location given by the user, with the file name they mentioned.

So , to get the particular location of the folder I'm using the input type=file tag.But I want it like ,instead of selecting a file,want to select a folder.I had seen some desktop projects like this, for example "Install creator" when you install an application ,it will ask for the location to install the software.
But I knew that in web application there is no need for those things ,anyway I would to implement this issue in my web based desktop project.Suggest me an idea, how it can be done?

Thanks,
techkar
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,422
Reputation: stymiee is on a distinguished road 
Solved Threads: 35
Moderator
stymiee's Avatar
stymiee stymiee is offline Offline
He's No Good To Me Dead

Re: Selecting a directory instead of file

 
0
  #8
Jan 16th, 2007
It can't be done without custom software being installed on the user's computer.
Last edited by stymiee; Jan 16th, 2007 at 10:36 am.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Selecting a directory instead of file

 
0
  #9
Jan 16th, 2007
When you download and install an application, the download part is deliberately in the user's control.

The install part is then able to access the filesystem, save files, etc.

Would you really want a server to be capable of installing software on your computer by the act of accessing a page on that server? Any browser or plugin that allows that kind of action is a total security risk.

(Temporarily ignoring Javascript) All you can do from a webpage is answer requests. A 'download' is just answering a request by sending the contents of a file. The browser then either asks the user where to put the file, or makes a good guess at where the file should go.

Javascript wont help you, because it's been designed deliberately to NOT allow read acces to anything on a user's computer, and to not allow write access anywhere.

Java Applets/Applications may help you out.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC