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 MathewsRank #225 · 11K reputationPosted Aug 9, 2018, 4:55 AM EDT
onais ahmerRank #9,026 · 212 reputationPosted Aug 10, 2018, 1:04 AM EDT
Jaish MathewsRank #225 · 11K reputationPosted Aug 9, 2018, 1:30 AM EDT
onais ahmerRank #9,026 · 212 reputationPosted Aug 9, 2018, 1:48 AM EDT
Jenith ThakkarRank #789 · 2.9K reputationPosted Aug 9, 2018, 3:07 AM EDT
Please Restart the PC and then Only Run your Project First and Try to Upload that file Again
Abhishek MishraRank #88 · 23.6K reputationPosted Aug 9, 2018, 3:44 AM EDT
onais ahmerRank #9,026 · 212 reputationPosted Aug 9, 2018, 4:16 AM EDT
Jaish MathewsRank #225 · 11K reputationPosted Aug 10, 2018, 2:56 AM EDT