Posted on: 12/16/2015 3:40:48 PM | Views : 1157

Hi. So I'm saving image from FileUpload. But I would like to save image from Image Control. How to change this code so, that image will be uploaded from Image control, not from FileUpload?
SqlConnection connection = null; try { FileUpload img = (FileUpload)imgUpload; Byte[] imgByte = null; HttpPostedFile File = imgUpload.PostedFile; imgByte = new Byte[File.ContentLength]; File.InputStream.Read(imgByte, 0, File.ContentLength); string conn = ConfigurationManager.ConnectionStrings["EmployeeConnString"].ConnectionString; connection = new SqlConnection(conn); connection.Open(); string sql = "INSERT INTO img(img) VALUES(@img) SELECT @@IDENTITY"; SqlCommand cmd = new SqlCommand(sql, connection); c ...

Go to the complete details ...