ASP.NET MVC3에서 개발 중이며 SQL Server 2008에서 파일을 저장하기위한 코드가 있습니다. IE (IE9)를 사용하면 잘 작동하지만 파이어 폭스에서 "인덱스가 범위를 벗어났습니다. 음수가 아니고 콜렉션의 크기보다 작아야합니다. \ r \ n 매개 변수 이름 : 인덱스"라는 오류 메시지가 나타납니다. 어떻게 수정해야합니까? 감사합니다Valums Ajax 파일 업로드는 IE에서 작동하지만 Firefox에서는 작동하지 않습니다.
[HttpPost]
public ActionResult FileUpload(string qqfile)
{
try
{
HttpPostedFileBase postedFile = Request.Files[0];
var stream = postedFile.InputStream;
App_MessageAttachment NewAttachment = new App_MessageAttachment
{
FileName = postedFile.FileName.ToString().Substring(postedFile.FileName.ToString().LastIndexOf('\\') + 1),
FilteContentType = postedFile.ContentType,
MessageId = 4,
FileData = new byte[postedFile.ContentLength]
};
postedFile.InputStream.Read(NewAttachment.FileData, 0, postedFile.ContentLength);
db.App_MessageAttachments.InsertOnSubmit(NewAttachment);
db.SubmitChanges();
}
catch (Exception ex)
{
return Json(new { success = false, message = ex.Message }, "application/json");
}
return Json(new { success = true }, "text/html");
}