0

i am uploading image using this html code

<div class="controls">
                    <input title="Select the file." type="file" class="ar_pic" name="ar_pic" id="ar_pic"/>
                </div>

i am not using form. i am sending value to locala.js the js code is

 "Update": function() { 
                var are_pic = $('#ar_pic').val(),
        imageNameIndex = are_pic.lastIndexOf('\\') + 1,
        area_pic = are_pic.substr(imageNameIndex); 
        $.post('LocalAUpdate.php',{
            user_id:id,area_pic:area_pic,action:'joined'
        });

and i tried using ajax but not working

$.ajax({
            type: "POST",
            url: "LocalAUpdate.php",
            enctype: 'multipart/form-data',
            data: {
                user_id:id,evt_id:evt_id,are_nam:are_nam,are_des:are_des,area_pic:are_pic,action:'joined'
            },
            success: function () {
                alert("Data Uploaded: ");
            }
        });

i am sending value to LocalAUpdate.php. the php code is given below

$fileName = $_FILES["area_pic"]["name"]; 
$fileTmpLoc = $_FILES["area_pic"]["tmp_name"];
$pathAndName = "uploads/".$fileName;
// Run the move_uploaded_file() function here
move_uploaded_file($fileTmpLoc, $pathAndName);

if(isset($_POST['user_id'],$_POST['area_pic']))
        {
        $are_pic = $_POST['area_pic'];
        $action = $_POST['action'];
        if ($action=='joined')
                    {
            user_joined_update($user_id,$are_pic);
                }
    }

i have created directory "uploads". but after click update button i cant see the image the directory is empty. i cant put die($fileName); or exit; php function it also not working. can u help me?

Luke
  • 77
  • 8

0 Answers0