I have the following input:
and the following javascript:
function click(){
    var reader = new FileReader();
    var bufferFile;
    var fileName = $('#upload').val();
    reader.onload = function (event) {
        bufferFile = event.target.result;
        var fd = new FormData();
        fd.append('fname', fileName);
        fd.append('bufferFile', bufferFile);
        $.ajax({
            type: 'POST',
            url: 'upload.php',
            data: fd,
            processData: false,
            contentType: false,
            success: function (data) {
                console.log(data);
            };
        });
    };
}
what I actually want is to upload the selected file into a file upload in the server.
The upload.php contains the upload function. When selecting a file, actually nothing happens what is going wrong?
 
    