在php中找到未定义的文件索引错误

时间:2015-11-27 18:42:32

标签: php

我正在尝试上传照片,但是这个错误让我感到害怕...帮助我...

(1) b + c = 0 mod 2
(2) a + c = 0 mod 2

等等....... 提交下面的代码后,这段代码就不见了......“

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$name     = $_FILES['file']['name'];
$tmpName  = $_FILES['file']['tmp_name'];
$error    = $_FILES['file']['error'];
$size     = $_FILES['file']['size'];
$ext      = strtolower(pathinfo($name, PATHINFO_EXTENSION));

switch ($error) {
    case UPLOAD_ERR_OK:
        $valid = true;
        //validate file extensions
        if ( !in_array($ext, array('jpg','jpeg','png','gif')) ) {
            $valid = false;
            $response = 'Invalid file extension.';
        }
        //validate file size
        if ( $size/1024/1024 > 2 ) {.........

任何人都可以帮助我吗?

0 个答案:

没有答案