Rawat

Rawat

  • 548
  • 2.1k
  • 23.1k

reduce image size when upload with binary image save databas

Nov 26 2016 3:18 AM
if (FileUpload1.HasFile || FileUpload2.HasFile || FileUpload3.HasFile || FileUpload4.HasFile || FileUpload5.HasFile || FileUpload6.HasFile)
{
int imagefilelenth1 = FileUpload1.PostedFile.ContentLength;
byte[] imgarray1 = new byte[imagefilelenth1];
HttpPostedFile image1 = FileUpload1.PostedFile;
image1.InputStream.Read(imgarray1, 0, imagefilelenth1);
int imagefilelenth2 = FileUpload2.PostedFile.ContentLength;
byte[] imgarray2 = new byte[imagefilelenth2];
HttpPostedFile image2 = FileUpload2.PostedFile;
image2.InputStream.Read(imgarray2, 0, imagefilelenth2);
int imagefilelenth3 = FileUpload3.PostedFile.ContentLength;
byte[] imgarray3 = new byte[imagefilelenth3];
HttpPostedFile image3 = FileUpload3.PostedFile;
image3.InputStream.Read(imgarray3, 0, imagefilelenth3);
 
 I have this code i need reduce image size and save it in database  using binary save image in database please help me 
int imagefilelenth4 = FileUpload4.PostedFile.ContentLength;
byte[] imgarray4 = new byte[imagefilelenth4];
HttpPostedFile image4 = FileUpload4.PostedFile;
image4.InputStream.Read(imgarray4, 0, imagefilelenth4);
int imagefilelenth5 = FileUpload5.PostedFile.ContentLength;
byte[] imgarray5 = new byte[imagefilelenth5];
HttpPostedFile image5 = FileUpload5.PostedFile;
image5.InputStream.Read(imgarray5, 0, imagefilelenth5);
int imagefilelenth6 = FileUpload6.PostedFile.ContentLength;
byte[] imgarray6 = new byte[imagefilelenth6];
HttpPostedFile image6 = FileUpload6.PostedFile;
image6.InputStream.Read(imgarray6, 0, imagefilelenth6);

Answers (3)