Jump to content


Photo

quick question


  • Please log in to reply
2 replies to this topic

#1 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 23 September 2006 - 10:33 PM

Hey

I am building a mini statis class which checks a file, resizes it and uploads it
and on error, gives an error code

I have checked the file size to see if its 0

but how do I work out the file size in Mega Bytes

Can someone help me fill in this gap
<?php
$max_file_size = 10; //in MB

$max_size_bytes = //This is the missing line

if($_FILES["upload_file"]["size"] >= $bytes){
$this->error_code = 5;
}
//rest of my code

?>

Tell me the problem, I will try tell you the solution

#2 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 23 September 2006 - 10:40 PM

one megabyte is equivalent to 1,048,576 bytes -- is that what you're looking for?

#3 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 23 September 2006 - 10:53 PM

yep
so the missing line would be

$max_size_bytes = $max_file_size * 1048576
Cheers
Tell me the problem, I will try tell you the solution




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users