severndigital Posted June 8, 2009 Share Posted June 8, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/161404-solved-selecting-a-folder-not-a-file/ Share on other sites More sharing options...
gevans Posted June 8, 2009 Share Posted June 8, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/161404-solved-selecting-a-folder-not-a-file/#findComment-851748 Share on other sites More sharing options...
severndigital Posted June 8, 2009 Author Share Posted June 8, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/161404-solved-selecting-a-folder-not-a-file/#findComment-851757 Share on other sites More sharing options...
gevans Posted June 8, 2009 Share Posted June 8, 2009 What it does is upload the file in question, and send them the temporary directory of the file. That's why the form encrypt type is different, telling the for/browser to deal with it as a file upload. Quote Link to comment https://forums.phpfreaks.com/topic/161404-solved-selecting-a-folder-not-a-file/#findComment-851767 Share on other sites More sharing options...
severndigital Posted June 8, 2009 Author Share Posted June 8, 2009 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! Quote Link to comment https://forums.phpfreaks.com/topic/161404-solved-selecting-a-folder-not-a-file/#findComment-851780 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.