开发者

$_FILES is null, $_POST is not null

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 givi开发者_Go百科ng me this result:

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

Any help would be greatly appreciated.


i'm not sure but first check if form contains

 enctype="multipart/form-data"

second check whats in $_FILES at all , i'm not sure if the $_FILES['importFile'] is right sintax ... i think it doesnt contain the name


Does the form tag have the enctype='multipart/form-data' attribute?


Have you set the enctype attribute of your form tag to multipart/form-data? It should read

<form enctype="multipart/form-data" ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜