PHP Upload PDF file
To dynamically upload a PDF file in a folder using PHP, you can use the following program: php Copy code <?php $target_dir = "uploads/" ; // specify the directory where you want to upload the file $target_file = $target_dir . basename ( $_FILES [ "fileToUpload" ][ "name" ]); // get the name of the uploaded file $uploadOk = 1 ; $fileType = strtolower ( pathinfo ( $target_file ,PATHINFO_EXTENSION)); // Check if file already exists if ( file_exists ( $target_file )) { echo "Sorry, file already exists." ; $uploadOk = 0 ; } // Allow only pdf files if ( $fileType != "pdf" ) { echo "Sorry, only PDF files are allowed." ; $uploadOk = 0 ; } // Check if $uploadOk is set to 0 by an error if ( $uploadOk == 0 ) { echo "Sorry, your file was not uploaded." ; // if everything is ok, try to upload file } else { if ( move_uploaded_file ( $_FILES [ "fileToUpload" ][ "...