Snooble Posted December 5, 2008 Share Posted December 5, 2008 Hey everyone, I'm using "move_uploaded_file" to upload a file to my server, if i use the $_FILES['name']['size'] command i get the size in BYTES. I need the size in mb! What's the best way to do this? So it looks like 2.43mb or 4.92mb. etc. Thank you in advance! Snoobs Quote Link to comment https://forums.phpfreaks.com/topic/135671-solved-problem-converting-bytes-to-mb-move_uploaded_file/ Share on other sites More sharing options...
papaface Posted December 5, 2008 Share Posted December 5, 2008 $size = $_FILES['name']['size'] / 1024; ??? Quote Link to comment https://forums.phpfreaks.com/topic/135671-solved-problem-converting-bytes-to-mb-move_uploaded_file/#findComment-706840 Share on other sites More sharing options...
Mchl Posted December 5, 2008 Share Posted December 5, 2008 Divide by 1048576 BTW: There is no such thing as millibit (mb). Use MB - as in megabyte Quote Link to comment https://forums.phpfreaks.com/topic/135671-solved-problem-converting-bytes-to-mb-move_uploaded_file/#findComment-706842 Share on other sites More sharing options...
Snooble Posted December 5, 2008 Author Share Posted December 5, 2008 $size = $_FILES['name']['size'] / 1048576; Will give me in MB? what's the function that will limit it to 2 decimal places? so 2.31413 will be 2.31MB? Thanks a lot so far people!! Snoobs Quote Link to comment https://forums.phpfreaks.com/topic/135671-solved-problem-converting-bytes-to-mb-move_uploaded_file/#findComment-706853 Share on other sites More sharing options...
Mchl Posted December 5, 2008 Share Posted December 5, 2008 round Quote Link to comment https://forums.phpfreaks.com/topic/135671-solved-problem-converting-bytes-to-mb-move_uploaded_file/#findComment-706854 Share on other sites More sharing options...
Snooble Posted December 5, 2008 Author Share Posted December 5, 2008 thank you very much SOLVED Quote Link to comment https://forums.phpfreaks.com/topic/135671-solved-problem-converting-bytes-to-mb-move_uploaded_file/#findComment-706869 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.