【发布时间】:2015-07-14 02:25:20
【问题描述】:
maxAllowedContentLength 和 maxRequestLength 在我的 web.config 文件中设置;但是,大型(1.8 GB+)文件仍然不适用于我的 Dropzone 上传。我有其他人处理过的以前的代码,并且该页面适用于我正在尝试的同一文件(2.94 GB),但我不想恢复到旧代码,除非它是绝对必要的,因为它不如拖放区。所以我知道它是 Dropzone 或我用来保存文件的代码。
foreach (string s in Request.Files)
{
HttpPostedFile file = Request.Files[s];
int fileSizeInBytes = file.ContentLength;
string fileName = file.FileName;
string fileExtension = file.ContentType;
if (!string.IsNullOrEmpty(fileName))
{
string subDir = "asdf";
fileExtension = Path.GetExtension(fileName);
subDir = User.Identity.Name.Split('@')[0];
fileName = Path.Combine(@"\\rocket\Assets\ftp\", subDir + "\\" + fileName);
string checkExists = fileName;
while (File.Exists(checkExists))
{
// get the file name without the extension
string[] temp = checkExists.Split('.');
string fileNameNoExtention = temp[temp.Length - 2];
checkExists = fileNameNoExtention + DateTime.Now.Second.ToString() + fileExtension;
}
// IMPORTANT! Make sure to validate uploaded file contents, size, etc. to prevent scripts being uploaded into your web app directory
file.SaveAs(checkExists);
Session["fileUploaded"] = checkExists;
}
}
我保存文件的方式有问题,还是 Dropzone 达到了限制?
【问题讨论】:
标签: c# asp.net file-upload dropzone.js