Jump to content

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

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.