Tôi có Bộ nhớ Azure Blob nơi tôi muốn tải lên một số tệp.
Index.cshtmlTải lên bộ nhớ Azure blob không thành công
@using (Html.BeginForm("File_post", "MyController", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<div class="editor-label">
<p>
<input type="file" name="file" />
</p>
<input type="submit" value="Upload" />
</div>
}
MyController.cs
public ActionResult File_post(HttpPostedFileBase file)
{
CloudBlobContainer blobContainer = Initialize(); // This Initialize my blobContainer
CloudBlockBlob blob;
blob = blobContainer.GetBlockBlobReference("myfile");
blob.UploadFromStream(file.InputStream);
Return("Index");
}
tôi thử nghiệm với một tập tin 3.5Mo, nó hoạt động ngay cả với một tập tin 20Mo. Bây giờ tôi thử với một 33Mo và firefox mang lại cho tôi những lỗi cơ bản: Kết nối được thiết lập lại ...
Edit: Khi tôi đặt
public ActionResult File_post(HttpPostedFileBase file)
{
Return("Index");
}
Nó mang lại cho tôi những lỗi tương tự, vì vậy tôi nghĩ nó không phải do mã C# của tôi gây ra.
Bất kỳ ý tưởng nào? Cảm ơn rất nhiều !
+1. Và đối với các tệp thực sự lớn, thời gian chờ yêu cầu mặc định là 2 phút có thể bắt đầu là một vấn đề. –