Search code examples
c#asp.netfile-uploadfilebrowse

How to disable the folder navigation in FileUpload control


How to disable the folder navigation in the browse file popup window that appears when browse button is clicked in FileUpload control.

Currently, the browse file popup window shows specific folder which contain subfolders and files; I want to limit the user; user should not be able to browse/navigate through the upper level folders.


Solution

  • The standard controls don't allow much flexibility. Possibly a more specialized component can help...

    You'd likely have to download a component or plugin to the user's browser that the user allows to install so you can access their local file system and custom traverse it. This used to be done with IE/ActiveX in the Windows world, but there were/are a lot of security issues with it and it's platform restrictive.

    A .NET-based component is Silverlight File Uploader.

    I think Telerik's File Upload control is somewhat flexible, and there are many similar 3rd-party components out there.

    Possibly use Flash like Gmail's email attachment upload component, concept shown this ASP.NET sample on CodeProject.

    Also you might consider a Java applet on the client like facebook's Image Uploader; for a similar developer component you might start looking into something like Java Uploader,

    All these client solutions are open or make source code available to help with ideas, except Telerik. All solutions are ubiquitous enough to support multiple browsers. Each component allows traversal of the local hard drives using a different UI/technology. I assume custom traversal or configuration is afforded by each to a degree.

    Expect the component to be secure first and secondly flexible for the programmer.