D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
markniuj
/
.vscode-server
/
data
/
User
/
History
/
-788bb34d
/
Filename :
B9wn.php
back
Copy
<?php <?php include "../config.php"; ?> // Handle file upload $uploadDirectory = "pdf_files/"; // Specify the directory where PDF files will be stored $uploadTitleCoverDirectory = "title_covers/"; // Specify the directory for title cover images $bookName = $_POST['book_name']; $book_author = $_POST['book_author']; $description = $_POST['description']; $pdfCategory = $_POST['pdf_category']; $pdfFile = $_FILES['pdf_file']; $titleCoverFile = $_FILES['title_cover']; // Add title cover file input $pdfFileName = $pdfFile['name']; $pdfFilePath = $uploadDirectory . $pdfFileName; $titleCoverFileName = $titleCoverFile['name']; // Get title cover file name if (move_uploaded_file($pdfFile['tmp_name'], $pdfFilePath)) { if (move_uploaded_file($titleCoverFile['tmp_name'], $uploadTitleCoverDirectory . $titleCoverFileName)) { // Insert data into the database $insertQuery = "INSERT INTO pdf_books (book_name, title_cover, upload_date, book_author, pdf_category, description, pdf_filename, hits, views) VALUES ('$bookName', '$titleCoverFileName', NOW(), '$book_author', '$pdfCategory', '$description', '$pdfFileName', 0, 0)"; if ($conn->query($insertQuery) === TRUE) { // Redirect to upload.php header("Location: success.php"); } else { echo "Error: " . $conn->error; } } else { echo "Error uploading title cover image."; } } else { echo "Error uploading PDF file."; } // Close the database connection $conn->close(); ?>