0

I'm using ajax file upload to upload a file together with other form contents but it doesn't seems to work.

 $.ajaxFileUpload({
    url: './uploadtest.php',
    secureuri: false,
    fileElementId: 'userfile',
    dataType: 'json',
    success: function (data, status) {
        if (data.status != 'error') {
            $('#userfile').val('');
        }
    }
});

Problem is the other form contents like text field are not submitted. Is it possible to submit them all at once using AJAX?

<form id="myform" method="post" accept-charset="utf-8" enctype="multipart/form-data">
<input type="file" name="userfile" size="20" id="userfile" />
<input type="text" name="nameuser" size="20">
<br /><br />
<button id="test">Send</button>
1
  • I think in the API you mentioned have only for the file upload.You may call another ajax in the success of file upload for submitting the form. or call the file upload in the success of form submit.
    – muthu
    Commented Jul 30, 2012 at 7:08

1 Answer 1

1

Try ajaxForm. This supports fileUpload.

Check this answer.

Not the answer you're looking for? Browse other questions tagged or ask your own question.