move_uploaded_file函数没有上传到服务器[重复]

This question already has an answer here:

file is not uploading into my server, I am using move_uploaded_file function, i got output as Your file was uploaded successfully. but file is not thare in that location.

image.html

<script>
$(document).ready(function(){
    $(document).on('change', '#profile_photo', function(){
        var file_data = $('#profile_photo').prop('files')[0]['name']; 
        var email_id=document.getElementById('email_id').value;
        var filename=document.getElementById('profile_photo').files[0]['name'];
        form_data.append('file', document.getElementById('profile_photo').files[0]);

        $.ajax({
                url:"https://imageupload.php",
                method:"POST",
                data:({'file':filename,'email_id':email_id }),
                beforeSend:function(){
                    $('#uploaded_image').html("<label class='text-success'>file Uploading...</label>");
                },   
                success:function(data) {
                    $('#uploaded_image').html(data);
                }
            });
        });
});
</script>

imageupload.php

<?php
$filename=$_POST['file'];
$email_id=$_POST['email_id'].substr($filename, -5);

if(file_exists("upload/" . $email_id)){
    echo  $filename . " is already exists.";
} else{
    move_uploaded_file($filename, "upload/" .  $email_id);
    echo $email_id."Your file was uploaded successfully.";
}
?>
</div>

imageupload.php Try Code below and make sure you set uploads folder permission to 777.

<?php
$filename=$_POST['file']['name'];
$tmppath = $_FILES['file']['tmp_name'];

$email_id=$_POST['email_id'].substr($filename, -5);
if(file_exists("upload/" . $email_id)){
    echo  $filename . " is already exists.";
} else{
    move_uploaded_file($tmppath, "upload/".$email_id);
    echo $email_id."Your file was uploaded successfully.";
}
?>