Posting input type file problem No Value posted

前端 未结 2 445
遥遥无期
遥遥无期 2020-12-11 00:50

I have a form where I\'m posting different fields and every type of field posted seems to work except the input File type.

I\'m using var_dump($_POST);

相关标签:
2条回答
  • 2020-12-11 01:05

    Actually if you try Firefox (>13), you can get the posted value. But if you are using Chrome or Safari, you can't get the posted value. I think the it is related with the Browsers.

    0 讨论(0)
  • 2020-12-11 01:09

    Files are stored in $_FILES, not $_POST

    http://php.net/manual/en/reserved.variables.files.php $_FILES variable

    http://www.php.net/manual/en/features.file-upload.php Manual on PHP File Uploads.

    To handle the file (no error checking):

    $ROOT = "/path/to/store/files";
    foreach($_FILES as $file => $details)
    {   // Move each file from its temp directory to $ROOT
        $temp = $details['tmp_name'];
        $target = $details['name'];
        move_uploaded_file($temp, $ROOT.'/'.$target);
    }
    

    See also http://www.php.net/manual/en/function.move-uploaded-file.php for more examples.

    0 讨论(0)
提交回复
热议问题