0

i try to insert a row to db with php and jquery

I have this code

$.post('/json/management/AddArtistAjax', 
    {
       "artistName": $("#nameSurnameID").val()
            ,
            "Country": $("#country").val()
            ,
            "bDate" :  $("#demo1").val()
            ,
            "dDate" :  $("#demo2").val()
            ,
            "bio" : $("#bioID").val()


    },
    function(response){
            alert(response);
        });

I can send php side all of above.However, i cannot send files to php side

print_r($_FILES) array is empty why ?

1 Answer 1

6

You cannot upload files like this via AJAX. If you do not need to support old browsers, you can use the form plugin which supports AJAX file uploads and can even fallback to a hidden iframe for older browsers.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.