Search code examples
asp.net-mvcasp.net-mvc-3file-browser

Asp.net mvc - TextBox with a browse button on filse on the server


I have a Asp.net MVC 3 project where I want to implement a textbox and a Browse button where I can browse on the path of the server /Content/Image and retrieve the filename of the file selected.

How to do it ?, as when I put in the view , it always browse the files locally, and what I want to do is to be able to Browse the /Content/Images from the server


Solution

  • You can not do that with standard controls. Traversing server filesystem in general poses high security risks and should be avoided as much as possible - so it's not implemented in any standard controls.

    What you can do is implement separate controller action + view listing files on your server using usual C# classes from System.IO.