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] Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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.