HttpPostedFileBase pstFile = Request.Files[0];
string upfile = Request.Files[0].FileName;
string time = DateTime.Now.ToString("yyyyMMddhhmmss");
upfile = time + upfile;
string file_url = "~/upload/images/" + upfile;
string path = Server.MapPath("~/upload/images/");
path = TuanDaiSchoolPath + "upload/images";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
string strSchoolFileName = string.Format(TuanDaiSchoolPath + "upload\\images\\{0}", upfile);
pstFile.SaveAs(strSchoolFileName);
Stream s = new FileStream(strSchoolFileName, FileMode.Open, FileAccess.ReadWrite);
//上传图片压缩处理
关掉那个文件.你打开了操作不了的
那需要怎么关掉呢?
@EpicOfGilgamesh:是不是你操作的这个文件 被打开了这个意思。
finnaly close
FileStream fs = new FileStream(Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
StreamReader sr = new StreamReader(fs, System.Text.Encoding.Default);