init
This commit is contained in:
commit
72a26edcff
22092 changed files with 2101903 additions and 0 deletions
24
upload2.php
Normal file
24
upload2.php
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
<?php
|
||||
if(!empty($_FILES)){
|
||||
|
||||
//database configuration
|
||||
$dbHost = 'localhost';
|
||||
$dbUsername = 'edv';
|
||||
$dbPassword = 'maxdata-01';
|
||||
$dbName = 'edv';
|
||||
//connect with the database
|
||||
$conn = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);
|
||||
if($mysqli->connect_errno){
|
||||
echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
|
||||
}
|
||||
|
||||
$targetDir = "upload/";
|
||||
$fileName = $_FILES['file']['name'];
|
||||
$targetFile = $targetDir.$fileName;
|
||||
|
||||
if(move_uploaded_file($_FILES['file']['tmp_name'],$targetFile)){
|
||||
//insert file information into db table
|
||||
$conn->query("INSERT INTO files (file_name, uploaded) VALUES('".$fileName."','".date("Y-m-d H:i:s")."')");
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue