Jump to content

[SOLVED] selecting a folder ... not a file


severndigital

Recommended Posts

does anyone know of a solution to this problem.

 

I would like to use an item similar to the

 

 <input type="file" name="folderSelect" id="folderSelect" /> 

 

But the user would only be selecting a directory. ALL the form field needs to get is the name of the directory they selected.

 

The site and/or the script is not going to do anything with the directory. All it will do is write the information to an XML file that is getting picked up by another system.

 

All i need to do if give the user the ability to choose folder from one of our internal network shares.

 

the background application will determine the rest of the information it needs.

 

anyone have a suggestion?

 

Thanks,

Pendal

 

 

 

 

Link to comment
Share on other sites

That's an interesting question, but without the answer you would like. Once you have a form each browser controlls its 'browing', and will only allow you to chose a file (not folder). You'd need something installed on a users computer to provide this for you, unless you get them to provide it as a string.

Link to comment
Share on other sites

I see. So what happens to the information when they select a file?

 

for example if i choose a file on my main drive the file text field fills up with something like

 

C:\myFolder\anotherFolder\YetAnotherFolder\myfile.pdf

 

I know this has nothing to do with you ... it just seems odd that it would retain that information in the field, but won't transfer it during a post or get.

 

I suppose I could use a javacript to extract the folder path from the field on a onBlur or something but i would still need to have them select a file within the folder.

 

Hmmmm... i'll have to dig into this one a little deeper.

Link to comment
Share on other sites

well my initial fix will be to have them type in the name of the folder they want.

 

and use Ajax/PHP to go to the server and return a list of directories that match and allow them to select one.

 

I understand the potential security risks involved with the file uploaded, but it would be nice to easily capture a folder name within native HTML ..

 

Oh well ... off to Ajax ... whoot!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.