Server IP : 184.154.167.98 / Your IP : 3.135.209.20 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/puertode/public_html/oficios/chido/ |
Upload File : |
<?php include('conexion.php'); if ($_SERVER['REQUEST_METHOD'] == 'POST') { $title = $con->real_escape_string(htmlentities($_POST['title'])); $description = $con->real_escape_string(htmlentities($_POST['description'])); $file_name = $_FILES['file']['name']; $new_name_file = null; if ($file_name != '' || $file_name != null) { $file_type = $_FILES['file']['type']; list($type, $extension) = explode('/', $file_type); if ($extension == 'pdf') { $dir = 'files/GAF/'; if (!file_exists($dir)) { mkdir($dir, 0777, true); } $file_tmp_name = $_FILES['file']['tmp_name']; //$new_name_file = 'files/' . date('Ymdhis') . '.' . $extension; $new_name_file = $dir . file_name($file_name) . '.' . $extension; if (copy($file_tmp_name, $new_name_file)) { } } } $ins = $con->query("INSERT INTO files(title,description,url) VALUES ('$title','$description','$new_name_file')"); if ($ins) { echo 'success'; } else { echo 'fail'; } } else { echo 'fail'; }