首页 > 代码库 > 用Fine Uploader+ASP.NET MVC实现ajax文件上传[代码示例]

用Fine Uploader+ASP.NET MVC实现ajax文件上传[代码示例]

借助 .NET 4.0 新增的 Stream.CopyTo (),可以轻松实现“流对流”保存上传文件,示例代码如下:

public ActionResult ProcessUpload(string filename){    using (var inputStream = Request.InputStream)    {        using (var flieStream = new FileStream(@"c:\temp\" + filename, FileMode.Create))        {            inputStream.CopyTo(flieStream);        }    }    return Json(new { success = true });}