Saving image files in GDI Plus
I have two image bitmaps in memory, both of same resolution(height x width x bpp). I would like to save one of them on to a file as JPG. I want to save the one which will take up lesser disk space or have a lesser file size. Can I find out the file size before saving the image?

Ankur JainRank #2,475 · 567 reputationPosted Aug 18, 2014, 3:52 AM EDT
try like this..
Add namespace:
Using System.IO;
string sMyFileName = "~/photos/test.jpg";
FileInfo finfo = new FileInfo(Server.MapPath(sMyFileName ));
long FileInBytes = finfo.Length;
long FileInKB = finfo.Length / 1024;
long FileInMB = FileInKB /1024;
Response.Write("File Size: " + FileInBytes.ToString() +
" bytes (" + FileInMB.ToString() + " MB)");
Dhaval Shah3 reputationPosted Aug 18, 2014, 4:01 AM EDT
Ankur JainRank #2,475 · 567 reputationPosted Aug 18, 2014, 8:21 PM EDT
sorry for that, i guess this time its correct, you can get file size in bytes at the time of uploading by using "FileUpload1.PostedFile.ContentLength" it gives you file size in bytes like this...