onlyican Posted September 23, 2006 Share Posted September 23, 2006 HeyI am building a mini statis class which checks a file, resizes it and uploads itand on error, gives an error codeI have checked the file size to see if its 0but how do I work out the file size in Mega BytesCan someone help me fill in this gap[code]<?php$max_file_size = 10; //in MB$max_size_bytes = //This is the missing lineif($_FILES["upload_file"]["size"] >= $bytes){$this->error_code = 5;}//rest of my code?>[/code] Link to comment https://forums.phpfreaks.com/topic/21816-quick-question/ Share on other sites More sharing options...
michaellunsford Posted September 23, 2006 Share Posted September 23, 2006 one megabyte is equivalent to 1,048,576 bytes -- is that what you're looking for? Link to comment https://forums.phpfreaks.com/topic/21816-quick-question/#findComment-97425 Share on other sites More sharing options...
onlyican Posted September 23, 2006 Author Share Posted September 23, 2006 yepso the missing line would be$max_size_bytes = $max_file_size * 1048576Cheers Link to comment https://forums.phpfreaks.com/topic/21816-quick-question/#findComment-97430 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.