I'm using move_uploaded_file to transfer some files that I selected to the other folder. It's working on my localhost but not in our server. I don't know why. Here are my codes.
<?php
include('connect.php');
if(isset($_POST['submit']))
{
$position = $_POST['position'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$contact_number = $_POST['contact_number'];
$email = $_POST['email'];
$status = 'NO';
$resume = $_FILES['resume']['name'];
$resume_tmp = $_FILES['resume']['tmp_name'];
$ret=explode('.',$_FILES['resume']['name']);
$file_ext=array_pop($ret);
$extensions = array("pdf","docx");
if(in_array($file_ext,$extensions )=== false){
echo "<script> alert('Unsupported format')</script>";
echo "<script>window.location='index.php';</script>";
}
else{
move_uploaded_file($resume_tmp,"resume/$resume");
$query=$pdo->prepare("INSERT INTO applicants(position,first_name,last_name,contact_number,email,resume,status) VALUES (:position,:first_name,:last_name,:contact_number,:email,:resume,:status)");
$query->bindParam(':position',$position);
$query->bindParam(':first_name',$first_name);
$query->bindParam(':last_name',$last_name);
$query->bindParam(':contact_number',$contact_number);
$query->bindParam(':email',$email);
$query->bindParam(':resume',$resume);
$query->bindParam(':status',$status);
$query->execute();
echo "<script> alert('You Successfully Applied to this Job')</script>";
echo "<script>window.location='index.php';</script>";
}
}
?>