views:

31

answers:

1

I'm using an <input type="file" /> as a file browser dialog in MVC. I don't actually want to upload the file though, I am using it to select a template on a shared drive. I only want to get the full filepath in my action method. The server will then process the file and force download to the client. I have got hold of the HttpPostedFileBase object, but I don't see a filepath property. Is this possible? Or if not, what other options are available?

+1  A: 

You will never be able to get the full path of a file from a file upload box because it is a security issue. No browser will pass you the full path, only the filename.

Additionally, the file upload box will always upload the file. Unfortunately, much like with the security issue of the full path, there is no way to show a file dialog and have the user pick a file without initiating an upload.

rakuo15