Hi i am having a hard time using move_uploaded_file function to pass file to a new location. I am using ajax to pass function to my process.php. Hope you can help me.
Here is my process.php
    $target_dir = "../files-here/";
    $filename = $_POST['filename']; 
    $path_url = $target_dir .$filename;
    if (file_exists($path_url)) {
            echo "Sorry, file already exists.";
            $uploadOk = 0;
        }
        else
        {
            if(move_uploaded_file($filename, $path_url))
            echo "The file".$filename."has been uploaded";Here is my form with ajax.
echo "<form method='post' enctype='multipart/form-data' id='test_ajax'>";
    echo "<input name='uploadedfile' type='file' id='custom-file-input' class='test-only' /><br/>";
    echo "</form>";
    echo '<button value="Upload" id="custom-submit-input">Upload</button>';
   <script>
jQuery('#custom-submit-input').click(function(){
          
var filename = jQuery('input[type=file]').val().replace(/.*(\/|\\)/, '');
           jQuery.post("file-here/process.php", {                   
                filename: filename
            }, function(data) {
                console.log(data);
                
            });  
   </script> 
    