how can i upload image on button click using ajax and php

Tuesday, November 3, 2015
$(".save").click(function()
{
var first_name = $("#fname").val();
var last_name = $("#lname").val();
var password = $("#new_pass").val();
var email = $("#new_email").val();
var profile_pic = $_FILES["profile_pic"]["name"];
$.ajax({
url:"<?php echo base_url() ?>index.php/home/update_profile",
type:"POST",
data:
{
fname:first_name,lname:last_name,newpass:password,newmail:email,profile_pic:profile_pic
},
success:function(result)
{
alert(result);
}
});
});


here i'm not getting the path for selected file
but i want to transfer file to server using php

0 comments:

Post a Comment