How To Upload Pdf File Using Php

[Solved] How To Upload Pdf File Using Php | Lisp - Code Explorer | yomemimo.com
Question : how to upload pdf file using php

Answered by : farmer-n21

//Form
<form method="post" action="db_connect.php" role="form" enctype="multipart/form-data">	<input type="file" name="pdf_file" id="pdf_file" accept="application/pdf" />	<button id="send" type="submit" name="submit" class="btn btn-success">Submit</button>
</form>
//create a file db_connect.php
/// create connection to your database using your localhost server, username, password // the name of your database
<?php
$allowedExts = array("pdf");
$temp = explode(".", $_FILES["pdf_file"]["name"]);
$extension = end($temp);
$upload_pdf=$_FILES["pdf_file"]["name"];
move_uploaded_file($_FILES["pdf_file"]["tmp_name"],"uploads/pdf/" . $_FILES["pdf_file"]["name"]);
$sql=mysqli_query($con,"INSERT INTO `Table Name`(`pdf_file`)VALUES($upload_pdf')");
if($sql){	echo "Data Submit Successful";
}
else{	echo "Data Submit Error!!";
}
?>

Source : | Last Update : Thu, 10 Feb 22

Question : how to include pdf in php page

Answered by : jilt-consult

<p>Insert message here, if the PDF cannot be displayed.</p>
</object>
</body>
</html>

Source : https://www.phpclasses.org/blog/post/1045-Embed-PDF-in-a-Web-Page.html | Last Update : Mon, 09 May 22

Answers related to how to upload pdf file using php

Code Explorer Popular Question For Lisp