Issue while uploading the large video files
I am trying to upload a video of size 670 MB. While uploading I am getting error.
404 - File or directory not found.
The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.
I am using the following code.
byte[] myData = new Byte[nFileLen];
myFile.InputStream.Read(myData, 0, nFileLen);
System.IO.FileStream newFile
= new System.IO.FileStream(Server.MapPath(sSavePath + sFilename),
System.开发者_如何学运维IO.FileMode.Create);
newFile.Write(myData, 0, myData.Length);
newFile.Close();
EDIT
It is being uploaded at intranet network only.
From Code Project:
During the construction of an intranet application that allows users to upload documents and share information between users, I noticed that when a user tries to upload files that are larger than 4 MB, he is asked for the user/password and even if he enters the correct user/password, the file is not uploaded, and he gets a HTTP 401.1 error.
Of course, this should not be an article, but CodeProject doesn't have a "quick tip section"-like, so here it goes.
By default, Machine.config is configured to accept HTTP Requests upto 4096 KB (4 MB) and it is reflected in all your ASP.NET applications. You can change the Machine.config file directly, or you can change only the Web.config file of the application(s) you want to.
Open your Web.config file, and just below the
<system.web>
tag, add the following tag:<httpRuntime executionTimeout="90" maxRequestLength="4096" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="100" enableVersionHeader="true" />
Now, just take a look at the maxRequestLength="4096" attribute of the tag. As you may have realized, all you need to do is change the value to some other value of your choice (8192 for 8 Mb, 16384 for 16 Mb, 65536 for 64 Mb, and so on...).
That's it. I hope it is useful to you.
Large File Uploading in
ASP.NET
Large file uploads in
ASP.NET
In order to upload files: Default file size is 4096 KB approx 5 MB We can increase size by updating maxRequestLength to max 11264 KB approx 11 MB
Thanks for the responses. Actually the issue is with server not allowing large files to upload. When I creating virtual directory on my machine and uploading then allows me.
精彩评论