Jquery post $_FILES -


this question has answer here:

$.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

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -