Faizan Shakeel
Faizan Shakeel

Reputation: 171

PHP not uploading file over 55 kb

Files more than 50 KB are not uploading. I have checked php.ini and i have following values

post_max_size = 16M (which i have increased from 3 MB but still no luck)
upload_max_filesize = 64M
max_file_uploads = 20

I've tried and read everything, couldn't find a solution, if anyone has gone thru the same problem, please share your experience.

PHP:

if(isset($_FILES["file"]))
{
    if($_FILES["file"]["error"] == 0)
    {
        $uploaded_file_name =  $_FILES["file"]["name"];
        move_uploaded_file($_FILES["file"]['tmp_name'], __DIR__ . "/" . $uploaded_file_name);
        exit;
    }
}

HTML:

<form action="<?php $_SERVER["PHP_SELF"] ?>" method="post" enctype="multipart/form-data">
    <label for="file">Filename:</label>
    <input type="file" name="file" id="file"><br>
    <input type="submit" name="submit" value="Submit">
</form>

Upvotes: 0

Views: 142

Answers (1)

Denzyl Dick
Denzyl Dick

Reputation: 293

The post_max_size must be equal or greater than upload_file_size

Example

 ; Maximum allowed size for uploaded files.
 upload_max_filesize = 64M

 ; Must be greater than or equal to upload_max_filesize  
 post_max_size = 64M

Upvotes: 1

Related Questions