//添加学生附件
StringBuilder bs = new StringBuilder();
int attCount = 0;
string filePath = "";
string strPath = "";
for (int j = 0; j < Request.Files.Count; j++)
{
if (Request.Files[j].ContentLength > 0)
{
filePath = Request.Files[j].FileName;
strPath = Server.MapPath("~/studentfile/") + filePath.Substring(filePath.LastIndexOf("\\") + 1);
bs.Append("Files" + attCount++ + ": " + filePath + "<br>");
Request.Files[0].SaveAs(strPath);
string NowTime = System.DateTime.Now.ToString("yyyyMMddHHmmssffff");
string NewFileName = NowTime + filePath.Substring(filePath.LastIndexOf("\\") + 1);
string FileType = filePath.Substring(filePath.LastIndexOf("\\") + 1).ToLower();
sfm1.StudentFile_Name = FileType;
sfm1.StudentFile_FileName = strPath;
sfm1.StudentFile_FileMewName = NewFileName;//新文件名
sfm1.Student_Id = i;
sfb1.StudentFileAdd(sfm1);
}
} 怎么无论我怎么改 新文件名都如图一样(最后一列) 都是一样的。
StringBuilder bs = new StringBuilder();
int attCount = 0;
string filePath = "";
string strPath = "";
for (int j = 0; j < Request.Files.Count; j++)
{
if (Request.Files[j].ContentLength > 0)
{
filePath = Request.Files[j].FileName;
strPath = Server.MapPath("~/studentfile/") + filePath.Substring(filePath.LastIndexOf("\\") + 1);
bs.Append("Files" + attCount++ + ": " + filePath + "<br>");
Request.Files[0].SaveAs(strPath);
string NowTime = System.DateTime.Now.ToString("yyyyMMddHHmmssffff");
string NewFileName = NowTime + filePath.Substring(filePath.LastIndexOf("\\") + 1);
string FileType = filePath.Substring(filePath.LastIndexOf("\\") + 1).ToLower();
sfm1.StudentFile_Name = FileType;
sfm1.StudentFile_FileName = strPath;
sfm1.StudentFile_FileMewName = NewFileName;//新文件名
sfm1.Student_Id = i;
sfb1.StudentFileAdd(sfm1);
}
} 怎么无论我怎么改 新文件名都如图一样(最后一列) 都是一样的。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货