小编Gav*_*vin的帖子

如何将httppostedfilebase转换为String数组

    public ActionResult Import(HttpPostedFileBase currencyConversionsFile)
    {

        string filename = "CurrencyConversion Upload_" + DateTime.Now.ToString("dd-MM-yyyy") + ".csv";
        string folderPath = Server.MapPath("~/Files/");

        string filePath = Server.MapPath("~/Files/" + filename);
        currencyConversionsFile.SaveAs(filePath);
        string[] csvData = System.IO.File.ReadAllLines(filePath);

        //the later code isn't show here
        }
Run Code Online (Sandbox Code Playgroud)

我知道将httppostedfilebase转换为String数组的常用方法,它首先将文件存储在服务器中,然后从服务器读取数据.无论如何直接从httppostedfilebase获取字符串数组而不将文件存储到服务器中?

asp.net-mvc httppostedfilebase

8
推荐指数
2
解决办法
8510
查看次数

标签 统计

asp.net-mvc ×1

httppostedfilebase ×1