Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 09, 2012 09:05 AM by newonehere69
Member
64 Points
85 Posts
Apr 06, 2012 12:15 PM|LINK
Hi,
I am working on an application that needs to be able to upload huge files.
Files that can be up to 200mb.
I need to know what I need to do to make the upload work with big files.
I already set up the maxRequestLength="200000" in the web config.
And this is the code I am working with: (I am working with asp.net and c#)
protected void btnIns_Click(object sender,ImageClickEventArgs e) { try { string documentName=txtDocName.Text; //fPath="~\\foldername\\"+ConfigurationManager.AppSettings["folderfor file"].ToString(); SqlDateTime mfDate=(Convert.ToDateTime(DateTime.Now.ToShortDateString())); myclass mf=new myclass (); string strFileName=fupdDoc.FileName; string filePath=fPath+strFileName; string fileExtension=Path.GetExtension(fupdDoc.FileName); string uName=User.Identity.Name.ToString(); if(fupdDoc.PostedFile!=null) { if(fupdDoc.HasFile) { DeleteFile(strFileName); string FileName=Path.GetFileName(fupdDoc.PostedFile.FileName); fupdDoc.SaveAs(Server.MapPath(fPath+FileName)); mf.Name=txtDocName.Text; mf.Url=filePath; mf.Type=fileExtension; mf.Active=ckPub.SelectedValue; mf.Date=mfDate; mf.Insert(); //Displays a confirmation message. MsgConfirm(); } } } catch(Exception ex) { lblErr.Text=ex.Message; } }
Thanks.
All-Star
33063 Points
8516 Posts
Moderator
Apr 06, 2012 12:18 PM|LINK
I think you have to multiply that by 1024 to get the right size. You're saying 200,000 bytes not 200,000,000. Check out this article:
http://nathondalton.wordpress.com/2010/02/23/retreiving-maxrequestlength-value-from-web-config/
Apr 06, 2012 12:22 PM|LINK
I stand corrected. That value is in kb. However, I think you may be running into some default of 29 Megs. With IIS 7+, you have to do a couple things to get around the limit. Take a look at this thread on teh IIS forums. Hope it helps you!
http://forums.iis.net/p/1150009/1993988.aspx
95493 Points
14106 Posts
Apr 07, 2012 09:58 AM|LINK
Even though if you set up maxrequestlength, i do see some problems with large fileuploads, read it here - http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net.aspx
Please review some other options what Jon mentioned in that link..
Thanks,
Apr 09, 2012 09:05 AM|LINK
I follow the stepts in this article and I was able to upload a 56mb video file.
Thanks for all the replies and suggestions.
newonehere69
Member
64 Points
85 Posts
Problem Uploading huge files(200mb)
Apr 06, 2012 12:15 PM|LINK
Hi,
I am working on an application that needs to be able to upload huge files.
Files that can be up to 200mb.
I need to know what I need to do to make the upload work with big files.
I already set up the maxRequestLength="200000" in the web config.
And this is the code I am working with: (I am working with asp.net and c#)
protected void btnIns_Click(object sender,ImageClickEventArgs e) { try { string documentName=txtDocName.Text; //fPath="~\\foldername\\"+ConfigurationManager.AppSettings["folderfor file"].ToString(); SqlDateTime mfDate=(Convert.ToDateTime(DateTime.Now.ToShortDateString())); myclass mf=new myclass (); string strFileName=fupdDoc.FileName; string filePath=fPath+strFileName; string fileExtension=Path.GetExtension(fupdDoc.FileName); string uName=User.Identity.Name.ToString(); if(fupdDoc.PostedFile!=null) { if(fupdDoc.HasFile) { DeleteFile(strFileName); string FileName=Path.GetFileName(fupdDoc.PostedFile.FileName); fupdDoc.SaveAs(Server.MapPath(fPath+FileName)); mf.Name=txtDocName.Text; mf.Url=filePath; mf.Type=fileExtension; mf.Active=ckPub.SelectedValue; mf.Date=mfDate; mf.Insert(); //Displays a confirmation message. MsgConfirm(); } } } catch(Exception ex) { lblErr.Text=ex.Message; } }Thanks.
bbcompent1
All-Star
33063 Points
8516 Posts
Moderator
Re: Problem Uploading huge files(200mb)
Apr 06, 2012 12:18 PM|LINK
I think you have to multiply that by 1024 to get the right size. You're saying 200,000 bytes not 200,000,000. Check out this article:
http://nathondalton.wordpress.com/2010/02/23/retreiving-maxrequestlength-value-from-web-config/
bbcompent1
All-Star
33063 Points
8516 Posts
Moderator
Re: Problem Uploading huge files(200mb)
Apr 06, 2012 12:22 PM|LINK
I stand corrected. That value is in kb. However, I think you may be running into some default of 29 Megs. With IIS 7+, you have to do a couple things to get around the limit. Take a look at this thread on teh IIS forums. Hope it helps you!
http://forums.iis.net/p/1150009/1993988.aspx
ramiramilu
All-Star
95493 Points
14106 Posts
Re: Problem Uploading huge files(200mb)
Apr 07, 2012 09:58 AM|LINK
Even though if you set up maxrequestlength, i do see some problems with large fileuploads, read it here - http://weblogs.asp.net/jgalloway/archive/2008/01/08/large-file-uploads-in-asp-net.aspx
Please review some other options what Jon mentioned in that link..
Thanks,
JumpStart
newonehere69
Member
64 Points
85 Posts
Re: Problem Uploading huge files(200mb)
Apr 09, 2012 09:05 AM|LINK
I follow the stepts in this article and I was able to upload a 56mb video file.
Thanks for all the replies and suggestions.