views:

236

answers:

3

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.

+1  A: 

The asp.net server control is really just a wrapped html input type=file . The problem you're experiencing isn't limited to ASP.net and unfortunately, there's no way to affect the browser's behavior on that from your app.

Paul
So, any workaround? Idea? Pointer?
KMan
+1  A: 

You can't do this with an input type=file but you may be able to if you can use a flash-based file upload control instead.

kristian
+1 I can think about flash based as well. Thanks for response.
KMan
A: 

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.

John K
Thanks for giving me the thinking lines.
KMan
After you accepted the solution I added a Telerik suggestion too and some more general clarification on the thinking pattern. Please report back if any of these solutions work for your needs.
John K