Pain Posted November 21, 2013 Share Posted November 21, 2013 (edited) Hi there. I have to add a file upload facility to the form. Theres just one problem though - the form is submitted via AJAX. $("#s_prop_full").validate({ submitHandler: function (form) { $.ajax({ type: "POST", url: "submit-proposal-full.php", data: $("#s_prop_full").serialize(), beforeSend: function() { $('#loader3').fadeIn(); }, complete: function(){ $('#loader3').fadeOut(); } }).done(function (msg) { $('#loader3').fadeOut(); $('#s_prop_full').fadeOut(); $('.s-form-full-thanks').fadeIn(); }); }, ..... It's pretty standard PHP after that: move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); What do i have to add to the AJAX function? Thank you Edited November 21, 2013 by Pain Quote Link to comment https://forums.phpfreaks.com/topic/284139-file-upload-via-ajax/ Share on other sites More sharing options...
denno020 Posted November 27, 2013 Share Posted November 27, 2013 I have used jQuery Form Plugin for this purpose before. It works well. http://malsup.com/jquery/form/#getting-started Denno Quote Link to comment https://forums.phpfreaks.com/topic/284139-file-upload-via-ajax/#findComment-1460331 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.