c# - Getting file size in KB -


i storing file in database in kb. try convert file length return file info kb follow.

fileinfo filevol = new fileinfo(downloadpath); int sizeinkb = (int)(filevol).length / 1024 ; 

if file size return db , value in size in kb equal code allow install software downloadpath. getting value in size in kb less of value return db (always 1 kb). wrong me.

please resolve.

fileinfo filevol = new fileinfo(downloadpath); string filelength = filevol.length.tostring(); string length = string.empty; if (filevol.length >= (1 << 10))   length= string.format("{0}kb", filevol.length >> 10); 

length=> result kb of file.


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -