This is my code to upload video on server
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string fileName = FileUpload1.FileName;
string fileExtension = Path.GetExtension(fileName);
if (fileExtension == ".flv")
{
if (!File.Exists(Path.Combine(Server.MapPath("~/Video"), fileNam开发者_如何学编程e)))
{
string fullFileName = Path.Combine(Server.MapPath("~/Video1"), fileName);
FileUpload1.SaveAs(fullFileName);
Label1.Text = "The file has been uploaded";
}
else
{
Label1.Text = "The file already exist! You must delete old version first in order to upload new version";
}
}
else
{
Label1.Text = "The file format is not allow";
}
}//else if
else
{
Label1.Text = "please select a file to upload";
}
}
Everything is goes well, but when I upload a .FLV
file, It returns me an error message on webpage,here is the error code
Output: Error 101 (net::ERR_CONNECTION_RESET): The connection was reset.
How can I solve this problem?
Maybe you are trying to upload a file larger than 4MB which is the default maximum allowed size. You may try increasing it in the web.config
:
<system.web>
<!-- Set the maximum upload file size to 100MB -->
<httpRuntime executionTimeout="240" maxRequestLength="102400" />
</system.web>
Generally, I set below code into my project..
<system.web>
<httpRuntime maxRequestLength="102000" executionTimeout="110"/>
</system.web>
But if you extend than...
The 4MB default is set in machine.config, but you can override it in you web.config. For instance, to expand the upload limit to 20MB, you'd do this:
<system.web>
<httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web
精彩评论