Jquery post $_FILES -
this question has answer here:
- how can upload files asynchronously? 25 answers
$.post('image.php', { image:form.image.value } <form id="form" enctype="multipart/form-data"> <input type="file" id="image" name="image"/> php->isset($_files['file'])
how use jquery post post $_files? inside of form tag, still need included enctype or need use ajax, , how can that?
use jquery form plugin ajax submit form files. http://malsup.com/jquery/form/
in js
$('#form').ajaxsubmit({ success: function(response) { console.log(response); } }); in php
// after doing upload work etc header('content-type: text/json'); echo json_encode(['message' => 'some message or param whatever']); die(); full docs , examples: http://malsup.com/jquery/form/#ajaxsubmit
Comments
Post a Comment