Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,

I need to know the best approach to upload large files on server (more than 150 MB) in asp.net web application.

Can anyone please help me out.

Thanks.
Posted

This[^] may help you.
 
Share this answer
 
Comments
Mehdi Gholam 6-Oct-11 8:31am    
The OP has posted a solution instead of a comment.
Abhinav S 6-Oct-11 9:26am    
Thanks for pointing that out.
Have a look at NeatUpload[^].
 
Share this answer
 
Comments
Mehdi Gholam 6-Oct-11 8:30am    
Nice, the OP has posted a solution instead of a comment.
AmarSinghRawat 6-Oct-11 8:43am    
Thanks guys for quick reply but I'm not looking for this.
currently I am using following method

protected void btnUpload_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
try
{
string fullpath = Server.MapPath("~/UploadFiles/");
string fileName = FileUpload1.FileName;
string RandomName = Path.GetRandomFileName() + Path.GetExtension(fileName);
string Size = FileUpload1.FileContent.Length.ToString();
fullpath += RandomName;
FileUpload1.SaveAs(fullpath);

con = new SqlConnection(objcon.ConnectionString());
con.Open();
Query = "Insert into Records values('" + fileName + "','" + RandomName + "'," + Size + "," + Session["LoginID"].ToString() + ",GetDate(),'" + Convert.ToString(Session["UserName"]) + "')";
com = new SqlCommand(Query, con);
com.ExecuteNonQuery();
}
catch (Exception ex)
{
lblErrMsg.Text += ex.ToString();
}
finally
{
con.Close();
BindGrid();
}

}
}

In web config I already set these things.

httpruntime executiontimeout="43200"
maxrequestlength="104856"

sessionstate mode="InProc"
cookieless="false"
timeout="43200"

but I think is not a best way to upload large files on server.
So that's why I want to know something better than this.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900