$_FILES is null, $_POST is not null

Posted by Cory Dee on Stack Overflow See other posts from Stack Overflow or by Cory Dee
Published on 2010-03-24T15:38:40Z Indexed on 2010/03/24 15:43 UTC
Read the original article Hit count: 196

Filed under:
|
|

When I am going to upload a file, my $_POST variable knows the file name, but the $_FILES variable is null. I've used this code before, so I'm really stumped.

Here's what I'm using for input:

<label for="importFile">Attach Resume:</label>
<input type="hidden" name="MAX_FILE_SIZE" value="10000000">
<input type="file" name="importFile" id="importFile" class="validate['required']">

And for processing:

$uploaddir = "E:/Sites/OPL/2008/assets/apps/newjobs/resumes/";
$uploadfile = $uploaddir . time() . '-' . urlencode(basename($_FILES['importFile']['name']));

if (!move_uploaded_file($_FILES['importFile']['tmp_name'], $uploadfile)) {
    echo 'Error uploading file. Error number: ' . $_FILES['importFile']['error'];
    var_dump($_FILES['importFile']);
    echo $_POST['importFile'];
    die();
}

Which is giving me this result:

Error uploading file. Error number: NULL
Maintaining The OPL Website.doc

Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about php

Related posts about fileupload