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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.