Как сохранить файл на диск?

Вот мой контроллер:

    [HttpPost]
    public ActionResult Index(HttpPostedFileBase excelFile)
    {

        /*Somewhere here, I have to save the uploaded file.*/

        var fileName = string.Format("{0}\\{1}", Directory.GetCurrentDirectory(), excelFile.FileName);
        var connectionString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=Excel 8.0;", fileName);

        var adapter = new OleDbDataAdapter("SELECT * FROM [workSheetNameHere$]", connectionString);
        var ds = new DataSet();
        adapter.Fill(ds, "results");

        DataTable data = ds.Tables["results"];

        return View();
    }
5
задан 25 February 2011 в 00:09
поделиться