I'm not unable to move the uploaded file to the desired path using move_uploaded function. Please help me out.
I tried to change my syntax to something like this:- $destination_path = getcwd().DIRECTORY_SEPARATOR; $target_path = $destination_path . basename( $_FILES["profpic"["name"]); Then also couldn't do it.
if(isset($_POST['otp-btn'])){
$otpa = $_POST['otp'];
$file_n = $_COOKIE['file_name'];
if($_COOKIE['otp'] == $otpa){
$destination = '/adhaar';
if(!move_uploaded_file($_COOKIE['tmp'], "$destination/$file_n")){
echo "<script>alert('File is not uploaded')</script>";
}
}
Every variable is fetching information(variables such as $_COOKIE['tmp'], $file_n) are not empty. I echoed it and it was carrying the information.
File is not getting uploaded.
if(isset($_POST['otp-btn'])){
$otpa = $_POST['otp'];
$file_n = $_COOKIE['file_name'];
if($_COOKIE['otp'] == $otpa){
$destination = './adhaar';
if(!move_uploaded_file($_COOKIE['tmp'], "$destination/$file_n")){
echo "<script>alert('File is not uploaded')</script>";
}
}
Try this.