htm11h
htm11h

Reputation: 1779

opening a local folder browser from web browser

I know this shouldn't be as hard as I have found it to be, but I could use some help on a problem. I have used, and am familiar with the FileUpload control, works great.

But now I have a need to allow the user to choose a folder path without selecting a file. Basically a folder location, on the local hard drive where my code will read the files located in the choosen folder and process against them.

I am drawing a total blank and my web searches are not giving me what I am looking for.

I initially developed this with a Windows FolderDialogBrowser control, but it will not run on the web server, likely a security issue, and I can not change it.

Public Class FolderBrowserDialogExampleForm 
Inherits Form 

Private folderBrowserDialog1 As FolderBrowserDialog 
Private openFileDialog1 As OpenFileDialog 

Private richTextBox1 As RichTextBox 

Private mainMenu1 As MainMenu 
Private fileMenuItem As MenuItem 
Private WithEvents folderMenuItem As MenuItem, _ 
                   closeMenuItem As MenuItem, _ 
                   openMenuItem As MenuItem 

Private openFileName As String, folderName As String 

Private fileOpened As Boolean = False

Is there some way to open the folder browser on the local machine, from a web browser? I'm not looking to salvage the code above unless there is a reasonable fix.

Full error message:

Compilation Error 
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. 

Compiler Error Message: BC30002: Type 'Form' is not defined.

Source error:

Line 10: 
Line 11: Public Class FolderBrowserDialogExampleForm
Line 12:     Inherits Form                             ' this line errors
Line 13: 
Line 14:     Private folderBrowserDialog1 As FolderBrowserDialog

Upvotes: 0

Views: 1930

Answers (2)

competent_tech
competent_tech

Reputation: 44931

The code that you are using is for windows forms, so it will not work in a web project. This is what the error messages are telling you.

If you want the user to select a directory on THEIR machine, then the standard File upload control will do the trick.

If you want the user to select a directory on the WEB server machine, then you will need to gather the list of folders that they can select from and present them to them in a Tree or other user interface construct that makes sense for the task you wish to perform.

Upvotes: 1

Jacob
Jacob

Reputation: 78850

There is no concept of folder selection in the HTML/JavaScript platform. Even if you could select one, you wouldn't be able to do anything with the folder path. If you use a plugin technology like Silverlight, Flash, or a Java applet, they may have folder selection and reading capabilities.

Upvotes: 1

Related Questions