D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
markniuj
/
bazmeasar.com
/
admin
/
Filename :
submit.php
back
Copy
<?php include "../config.php"; // Handle file upload $uploadDirectory = "uploads/pdf/pdf_files/"; // Specify the directory where PDF files will be stored $uploadTitleCoverDirectory = "uploads/pdf/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: index.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(); ?>