HBen Posted May 24, 2014 Share Posted May 24, 2014 Hello guys , i hope everyone is doing great ! So i was trying to get a file size from the file i uploaded to the BD , i succeded to get it using $filesize=$_FILES['uploadMedia']['size']; but the problem was that i got the size in form of bits 348160 bits instead of 340 KB is there any way to convert the bits to kb and Mb ?? i tried this function filesize($filename) but no luck Thank you Guys Link to comment Share on other sites More sharing options...
Ingolme Posted May 24, 2014 Share Posted May 24, 2014 A kilobyte is 1024 bytes, a megabyte is 1024 kilobytes. 1 Link to comment Share on other sites More sharing options...
HBen Posted May 24, 2014 Author Share Posted May 24, 2014 A kilobyte is 1024 bytes, a megabyte is 1024 kilobytes. lol i made a mistake in "348160 bytes instead of 340 KB" , so any idea how can i get the size in kb ! Link to comment Share on other sites More sharing options...
Ingolme Posted May 24, 2014 Share Posted May 24, 2014 Have you ever done conversions between units before? Knowing how many bytes you have you can convert it to kilobytes or megabytes or gigabytes with a simple mathematical operation. 1 Link to comment Share on other sites More sharing options...
HBen Posted May 24, 2014 Author Share Posted May 24, 2014 (edited) i didn't think of that ,i was focusing that there are a function to do that . thanks Ingolme Edited May 24, 2014 by HBen Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now