cant upload above 100kb

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
inosent
Forum Newbie
Posts: 4
Joined: Fri Mar 16, 2007 1:51 pm

cant upload above 100kb

Post by inosent »

Hi

i have checked the cPanel and it notes:

File Uploads file_uploads On
File Uploads upload_max_filesize 50M

my code is

Code: Select all

<?php
if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) {
  $filename = basename($_FILES['uploaded_file']['name']);
  if (($_FILES["uploaded_file"]["size"] < 100000000)) {
      $newname = dirname(__FILE__).'/upload/'.$filename;
      if (!file_exists($newname)) {
        if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) {
           echo "It's done! The file has been saved as: ".$newname;
        } else {
           echo "Error: A problem occurred during file upload!";
        }
      } else {
         echo "Error: File ".$_FILES["uploaded_file"]["name"]." already exists";
      }
  } else {
     echo "Error: Size limit exceeded";
  }
} else {
 echo "Error: No file uploaded";
}
?>



but no matter what i do to the size section, i cant upload past 100kb

does anyone know how to fix this?

thanks
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: cant upload above 100kb

Post by Darhazer »

What is the value of $_FILES['uploaded_file']['error'] ?
inosent
Forum Newbie
Posts: 4
Joined: Fri Mar 16, 2007 1:51 pm

Re: cant upload above 100kb

Post by inosent »

honestly, i am not sure

i think there is some code in that script that shouldnt be there, related to file type. i dont want any restrictions, file, or file size, just want a simplified script to upload a file of any type and any size to my server, up to, i guess, the 50MB limit, shown in cPanel.

when i upload a file via cPanel, they tell me on that page the file size limit is 22.95 MB, which for my purposes is fine also

i am guessing there is something in the code that is causing the 100kb limit issue because i dont see anything on the servier side creating that limit.

thanks for the reply
Post Reply