1

在我们的 ASP MVC3 中,我们需要允许用户导航到我们 LAN 上的共享文件夹并选择他们想要与特定项目关联的文件。我们想维护一个item的副本,所以我们不想做任何上传/下载,我们只想将指定的文件路径作为一个字段存储在SQL表中。最好的方法是什么?现在我可以使用这个助手打开一个文件浏览器窗口并选择文件,但是只有文件名被存储。

@Html.TextBoxFor(model => model.Attachments[0].Filepath, new { type = "file" })
4

1 回答 1

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.

于 2013-04-07T08:26:09.770 回答