标签:map content message error erro try return uniq cdb
string fileName = fileData.FileName; string path = System.Web.HttpContext.Current.Server.MapPath("~/UploadFile"); string filePath = System.IO.Path.Combine(path, fileName); string newFileName=FileHelper.GetUniqueFileName(filePath); string newFilePath = System.IO.Path.Combine(path, newFileName); try { byte[] buf = new byte[fileData.ContentLength]; Stream inputStream = fileData.InputStream; inputStream.Read(buf, 0, fileData.ContentLength); inputStream.Close(); FileStream outputStream = new FileStream(newFilePath, FileMode.Create); outputStream.Write(buf, 0, buf.Length); outputStream.Close(); return Json(new { error = 0, msg = "success", fileName = newFileName, fileUrl = "/UploadFile/" + newFileName }); } catch (Exception e) { return Json(new { error = 1, msg = e.Message }); }
标签:map content message error erro try return uniq cdb
原文地址:http://www.cnblogs.com/liandy0906/p/7427809.html