$ _FILES为空,$ _ POST不为空 [英] $_FILES is null, $_POST is not null

查看:72
本文介绍了$ _FILES为空,$ _ POST不为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我要上传文件时,我的$ _POST变量知道文件名,但是$ _FILES变量为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']">

并进行处理:

$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();
}

哪个给我这个结果:

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

任何帮助将不胜感激.

推荐答案

我不确定,但请先检查表单是否包含

i'm not sure but first check if form contains

 enctype="multipart/form-data"

第二次检查$ _FILES中的所有内容,我不确定$ _FILES ['importFile']是否正确……我认为它不包含名称

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

这篇关于$ _FILES为空,$ _ POST不为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆