i am trying to uploading the txt file near 1 GB
i modify the Web.config file but

- protected void Upload(object sender, EventArgs e)
- {
- string filename = Path.GetFileName(FileUpload1.PostedFile.FileName);
- string contentType = FileUpload1.PostedFile.ContentType;
- using (Stream fs = FileUpload1.PostedFile.InputStream)
- {
- using (BinaryReader br = new BinaryReader(fs))
- {
- br.ReadBytes((Int32)fs.Length) );
- // At this line i got the errorr msg
- byte[] bytes = br.ReadBytes((Int32)fs.Length);
- string constr = ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString;
- using (SqlConnection con = new SqlConnection(constr))
- {
- string query = "insert into Files values (@Name, @ContentType, @Data)";
- using (SqlCommand cmd = new SqlCommand(query))
- {
- cmd.Connection = con;
- cmd.Parameters.AddWithValue("@Name", filename);
- cmd.Parameters.AddWithValue("@ContentType", contentType);
- cmd.Parameters.AddWithValue("@Data", bytes);
- con.Open();
- cmd.ExecuteNonQuery();
- con.Close();
- }
- }
- }
- }
- Response.Redirect(Request.Url.AbsoluteUri);
- }
Jaish MathewsPosted Aug 9, 2018, 8:55 AM
Jaish MathewsPosted Aug 10, 2018, 6:56 AM
onais ahmerPosted Aug 10, 2018, 5:04 AM
onais ahmerPosted Aug 9, 2018, 8:16 AM
Abhishek MishraPosted Aug 9, 2018, 7:44 AM
Jenith ThakkarPosted Aug 9, 2018, 7:07 AM
Please Restart the PC and then Only Run your Project First and Try to Upload that file Again
onais ahmerPosted Aug 9, 2018, 5:48 AM
Jaish MathewsPosted Aug 9, 2018, 5:30 AM