Jump to content

Get Filesize


phpSensei

Recommended Posts

I have an upload application fixed up and everything but I seem to have one problem. I can get the file size but it just shows up numbers like "2323", but does not show the KB, GB , MB or anything..

 

Is there any function that can count the file size to megabytes if it exceeds 1000 kb? or if it is less than 1000 it shows kb?

Link to comment
https://forums.phpfreaks.com/topic/62123-get-filesize/
Share on other sites

  if(!$_FILES['_image'])

  return "Error encoding file";

 

  $name = explode('.', $_FILES["_image"]["name"]);

  $ext = $name[count($name)-1];

 

  $ext = strtolower($ext);

 

  if($ext == "jpeg")

  $ext == "jpg";

 

  if($ext != "jpg" && $ext != "png" && $ext != "gif")

  return "Invalid filetype.";

 

Link to comment
https://forums.phpfreaks.com/topic/62123-get-filesize/#findComment-309310
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.