weixin_33701617 2019-07-31 21:48 采纳率: 0%
浏览 69

未定义的索引上传

why it shows me this error: "Undefined index: Upload" ?

I have found many posts on this topic and have revised my code but it does not work

HTML:

<form method="POST" class="formphoto" enctype="multipart/form-data">

<input type="file" name="upload" class="inputfile" id="file1">

Ajax

$('.inputfile').on('change', function(event) {

// var upload = event.target.value;

$.ajax({
    type: 'POST',
    method: 'POST',
    url: '../MeetBlog/pages/upload_cache/upload_cache.php',
    data: new FormData($(".formphoto")[0]),
    cache: false,
    contentType: false,
    processData: false,
    success: function(data) {
        $('.imgshow').html(data);
    },
    });
}); 
});

PHP

<?php
session_start();
require_once __DIR__ . '/../../config/connect.php'; 

var_dump($_FILES['upload']['tmp_name']);

?>

This comes to the Server:

This comes to the Server

  • 写回答

0条回答 默认 最新

    报告相同问题?