I am currently trying to upload a file through a form I made, using jQuery. This is what I am attempting to do:
    function ajax_upload(){
    var formData = new FormData($('form#userform'));
        $.ajax({
        url: location.protocol + "//" + location.host + "/profile/uploadPicture",
        dataType: 'json',
        data: formData,
        type: 'post',
        success: function(data, status){
        if (data.status == 'error') {
            $('#error').html(data.msg);
        }
        else {
            var filename = location.protocol + "//" + location.host + "/data/profiles/" + data.msg;
            $('input#filename').val(filename);
            close_upload_form();
            pop_profilechanger(filename);
        }
    }
});
    return false;
}
the form appears to post to the backend, but while trying to return the filename from the uploaded file in a JSON object like: echo json_encode(array('status' => $status, 'msg' => $msg));
Is there something wrong? Please tell me
 
     
    