Michiel
Michiel

Reputation: 8083

PHP upload form doesn't accept .pdf

For some reason, my PHP-upload field doesn't accept pdf-files. I don't get it cause I thought there is no selection made while uploading the file... Any advice?

$name = $_FILES["uploadedfile"]["name"];
$tmp_name = $_FILES["uploadedfile"]["tmp_name"];
$add = "downloads/lkverslagen/".$name;

move_uploaded_file($tmp_name, $add);

if(file_exists("downloads/lkverslagen/$name")) {

    $lkverslag = new LKverslag();
    $jaar = date (Y);

    $lkverslag->titel           = $titel;
    $lkverslag->datum           = $datecorrect;
    $lkverslag->link            = $name;
    $lkverslag->jaar            = $jaar;
    $lkverslag->auteur          = $_SESSION['user']['naam'];
    $lkverslag->teller          = $_POST['titel'];

    if ($lkverslag->saveverslag($_DB)) {
        $feedback = "OK";
    } else {
        $feedback = "NOT OK";
    }
} else {
    $feedback = "ERROR";
}

Upvotes: 0

Views: 798

Answers (2)

Michał Wojciechowski
Michał Wojciechowski

Reputation: 2490

So, to repeat my comment: there are limits on the allowed size of uploaded files -- the PDF file might simply be too large.

Upvotes: 1

Jesse Bunch
Jesse Bunch

Reputation: 6679

Here are some things to check:

If none of this helps, enable error reporting and post what you receive so we can tailor our answers better to your situation.

Upvotes: 3

Related Questions