Jump to content

Filesize function


merylvingien

Recommended Posts

Having an issue where a peice of code is just being ignored.

 

<?php
if($_POST){
$image =$_FILES["image"]["name"];
$img = $_FILES['image']['tmp_name'];
$size= filesize($_FILES["image"]["name"]);
$maxsize= 400;

if ($size > $maxsize*1024){
echo "File too big";
exit();
} 
else
{

 

That is the first bit of code in the page, if i upload a image within the size allowance everything is ok, but if i try one which is a lot bigger, it ignore the if $size >  statement and just continues on and throws a bunch of errors.

 

Any ideas?

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

Actually its working fine, but as i was loading a file which was larger than the allowed size in the php.ini file, thats why the errors were throwing up.

 

Researching how to prevent a larger than allowed file to be uploaded and prevent the errors to start with.

Link to comment
https://forums.phpfreaks.com/topic/220271-filesize-function/#findComment-1141501
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.