【发布时间】:2018-11-01 19:50:37
【问题描述】:
我有MVC application,它有浏览按钮我正在选择文件的任何位置并使用路径读取文件内容,然后处理内容。
在本地运行良好,但在 azure 作为网络应用发布时,显然无法获取文件系统路径,但如何处理?
找不到文件“D:\Windows\system32\mydata.json”。
Index.cshtml
<label>File Path</label>
<table>
<tr>
<td>@Html.TextBoxFor(m => m.filePath, new { type = "file", @class = "input-file" }) )</td>
<td> </td>
</tr>
</table>
HomeController.cs
private static void Test(string filepath)
{
string data = System.IO.File.ReadAllText(filepath);
JArray array = JArray.Parse(data);
【问题讨论】:
标签: c# .net asp.net-mvc azure azure-web-app-service