I have one question. Is possible upload image from file input to MySQL with Ajax POST and PHP?
Like this:
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("#form_id").submit(function(){
$.ajax({
type:"POST",
data:image_data,
url:"/path_to_php/ImageSave.php",
success: function(msg){
alert("ok");
}
});
return false;
});
});
});
</script>
<form name="form_name" id="form_id" action="#" method="POST">
<input type="file" name="image" id="image" />
<button>Save</button>
</form>
upload file and store it on database can be done by several ways. this is one tutorial for doing this.. But the problem is if you want to do that using Ajax, it is definitely possible, check this out but almost common browser doesnt support it, the solution is:
Try this.
<script type="text/javascript">
$(document).ready(function(){
$("#button").click(function(){
var form_data = $('#reg_form').serialize();
$.ajax({
type:"POST",
url:"/path_to_php/ImageSave.php",
data:form_data,
success: function(data)
{
$("#info").html(data);
}
});
});
});
</script>