kujoy Posted February 22, 2010 Share Posted February 22, 2010 Hiya. I'm in the process of building a cms where users will need to link to files on the server. I have a system working but its not as good I wanted which lists the contents of a directory to a drop down list. The app works over a few pages so I can get the value I want and store it in the database. What im looking for is a widget with a button next to text field in a form that brings up a file browser window. Then I want to be able to browse the directory tree to the file I want and pass the the full path value back to the form text field so I can save it in the database. I have looked a lot of the file managers out there, but can't find anything that fits, and I havent seen it done elsewhere this way. Any ideas on how this can be done or know of somewhere it has been done so i can look at the code. TIA Mark. Link to comment https://forums.phpfreaks.com/topic/192924-how-to-browse-to-a-file-on-the-server-and-insert-the-value-into-an-input-field/ Share on other sites More sharing options...
alpine Posted February 22, 2010 Share Posted February 22, 2010 You cannot open the standard browse window on a server location, you have to make your own file browse window. Look into http://no.php.net/manual/en/function.readdir.php - there is som user examples you can start with. Then you will have to use javascript in one way or another (easiest) to move filenames between browse window and form. Link to comment https://forums.phpfreaks.com/topic/192924-how-to-browse-to-a-file-on-the-server-and-insert-the-value-into-an-input-field/#findComment-1016083 Share on other sites More sharing options...
kujoy Posted February 22, 2010 Author Share Posted February 22, 2010 Im currently using the method you describe to create and populate a drop own list. But I have to run it over a few pages because the some files are in the root and some are in folders. So at the moment i have select which folder I want to look in on the first page then select the file on the next page to build up the path. It works, but I was hoping to combine the pages using some sort of pop up window that shows a full directory tree so i can drill down to the file i want in one go. Sorry I wasn't clear about the file browser, I didnt mean the one for the operating system. I mean't using within php JS etc. Any further help would be great. Link to comment https://forums.phpfreaks.com/topic/192924-how-to-browse-to-a-file-on-the-server-and-insert-the-value-into-an-input-field/#findComment-1016093 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.