Friday, March 23, 2012

How to get the images files size?

Hi,
I want to retrive the images from SQL database and store into microsoft access database.
But only images file which is <than 500mb is allowed to retireve.How can i get the images files size if i just store the image file name into my sql database.(there is another folder to store images)

p@.ywen.You can use something like this:


// Create a reference to the image directory.
System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(strFileDirectory);
// Create an array representing the files in the current directory.
System.IO.FileInfo[] fi = di.GetFiles("*.jpg");

// then get file size
int fileSize = fi[0].Length;

|||Thanks for your reply, but one more question here.

After i create the array to store the images, then when i wan to get the files size
i need to loop until EOF right?|||No, you can just loop through the array using a standard for or a foreach.sql

No comments:

Post a Comment