Click here to Skip to main content
15,918,808 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to upload multiple images to the server, while uploading need to compress the file size

What I have tried:

foreach (HttpPostedFile thefile in FileUpload1.PostedFiles)
        {
            string sfile = thefile.FileName;
            string spath = Server.MapPath("~/Uploads");
            string sfullpath = Path.Combine(spath, sfile);
            thefile.SaveAs(sfullpath);

        }
Posted
Updated 20-Jun-21 19:39pm

1 solution

Unless you're uploading .BMP files, images are compressed already. You're not going to compress them more than they already are.
 
Share this answer
 
Comments
Rashad Hameed 21-Jun-21 1:41am    
is there any option to reduce the image size more than that?
Dave Kreskowiak 21-Jun-21 1:42am    
Again, you cannot compress images more than they already are. So, no.

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