1 回答
TA贡献1828条经验 获得超13个赞
我重新保存了文件,然后服务器认为它不处理相同的文件
protected void FileUploadButton_Click(object sender, EventArgs e)
{
try
{
//File upload logic. Returns path of uploaded file
string filePath = Server.MapPath("~/Files/") + Path.GetFileName(FileUploader.PostedFile.FileName);
//File save to server. Saves file name as uploaded by user to folder, "Files" on the server
string path = System.IO.Path.Combine("~/Files/",Path.GetFileName(FileUploader.PostedFile.FileName));
string day = DateTime.Now.ToString("ss_mm_hh_dd_MM_yyyy");
FileUploader.SaveAs(Server.MapPath(path));
//Function to insert values in excel sheet to database
InsertIntoDatabase(filePath)
//Resave file to keep track of uploaded files
File.Copy(filePath, day + filePath);
File.Delete(filePath);
}
catch (Exception Ex)
{
}//End try
}//End FileUpload
- 1 回答
- 0 关注
- 111 浏览
添加回答
举报