1

In our ASP MVC3, we need to allow the user to navigate to a shared folder on our LAN and select the file they want associated with a particular item. We want to maintain one copy of the item, so we don't want to do any uploading/downloading, we just want to store the specified file path as a field in a SQL table. What is the best method to do this? Right now I can use this helper open a file browser window and select the file, however only the file name gets stored.

@Html.TextBoxFor(model => model.Attachments[0].Filepath, new { type = "file" })
NealR
  • 10,189
  • 61
  • 159
  • 299
  • 3
    An `` isn't the right approach, it's going to be uploaded (unless I'm misunderstanding). You're going to have to implement some file-browser/listing method server-side (assuming the server has network access) then allow the user to pick from the selection. Then, of course, store that result in the db. – Brad Christie Apr 07 '13 at 00:34

1 Answers1

0

What is the best method to do this?

You could use a normal input field, not a file field:

@Html.TextBoxFor(model => model.Attachments[0].Filepath)

Now the user can copy paste the file path in this field. That's what HTML has to offer you. If it doesn't suit your needs you always have the possibilities of using some client side scripting such as a Flash movie or Silverlight that will be installed on your clients browsers and might require elevated privileges in order to access the file system.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928