Search
 
SCRIPT & CODE EXAMPLE
 

PHP

how to upload pdf file using php

//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!!";
}
?>
Comment

PREVIOUS NEXT
Code Example
Php :: leaf php 
Php :: generate random color php 
Php :: select next occurrence phpstorm 
Php :: laravel model undefined property 
Php :: WebSocket connection to ‘wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data’ failed: Error during WebSocket handshake: Unexpected response code: 403 
Php :: Add class to menu anchors 
Php :: laravel General error: 1215 Cannot add foreign key constraint" 
Php :: strtolower cyrillic 
Php :: php move uploaded file 
Php :: country 
Php :: php get result sql server 
Php :: php 7.1.1 download 
Php :: php boolean 
Php :: find string lenght in php 
Php :: $this 
Php :: php cheat sheet 
Php :: logout php code 
Php :: install php7.2 ubuntu 20.04 
Php :: how to convert string to int in php laravel 
Java :: how to change font size in JLabel 
Java :: getcolor deprecated 
Java :: priority queue reverse order java 
Java :: java get excectuon time 
Java :: java hashmap entryset 
Java :: center justify jlabel 
Java :: float to string java 
Java :: how to uppercase the first letter of a string in java 
Java :: error: package android.support.v4.content does not exist import android.support.v4.content.FileProvider; ^ 
Java :: add label gui jframe java 
Java :: como utilizar random en java 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =