Je rencontre un problème lors de l'utilisation de FileUpload pour les fichiers volumineux. Si je télécharge un petit fichier (~ 10kB), cela fonctionne très bien. Le téléchargement d'un fichier volumineux (~ 60 Mo) ne génère pas d'exception, il suffit de recharger la page. Avant que quiconque demande: <httpRuntime maxRequestLength="2097151" executionTimeout="3600" waitChangeNotification="1" maxWaitChangeNotification="3600" requestValidationMode="2.0" />
ASP FileUpload Silent Fail
Page:
<%@ AutoEventWireup="true" CodeFile="~/LargeFileUploadControl.aspx.cs" Inherits="LargeFileUploadControl" %>
<html>
<body>
<form runat="server">
<asp:Label ID="theOnlyLabel" runat="server" Text="Uploaded files will go to a place"/><br />
<asp:FileUpload ID="theOnlyUpload" runat="server" /><br />
<asp:Button ID="theOnlyButton" onClick="StartUpload" Text="Upload" runat="server" />
</form>
</body>
</html>
code derrière:
public partial class LargeFileUploadControl:Page
{
public string _uploadDir;
/// <summary>
/// Content loaded event handler
/// </summary>
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
_uploadDir = "D:\\web\\tikt.imaginuity.com\\TIKT\\media\\TIKT\\Global Large Uploads\\";
theOnlyLabel.Text = "Uploaded files will go to " + _uploadDir;
}
protected void StartUpload(object sender, EventArgs e)
{
if (theOnlyUpload.HasFile)
{
theOnlyLabel.Text = "Uploading...";
theOnlyUpload.SaveAs(_uploadDir + theOnlyUpload.FileName);
theOnlyLabel.Text = "File saved to " + _uploadDir + theOnlyUpload.FileName;
}
else
{
theOnlyLabel.Text = "No file to upload";
}
return;
}
}
EDIT: j'avais déjà essayé ci-dessous la réponse acceptée, ce que je pensais. En regardant à nouveau, j'ai découvert qu'il y avait deux sections<system.webServer>
dans mon web.config que les deux avaient besoin de changement.