D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
markniuj
/
bazmeasar.com
/
admin
/
mp4-bar
/
Filename :
upload.php
back
Copy
<?php include '../../config.php'; // Include your database connection if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) { $file = $_FILES['file']; // File details $fileName = $file['name']; $fileTmpName = $file['tmp_name']; // Other form data $mp4_title = $_POST['mp4_title']; $mp4_category = $_POST['mp4_category']; $urdu = $_POST['urdu']; $english = $_POST['english']; // Move uploaded file to a desired directory $uploadDirectory = 'uploads/'; $destination = $uploadDirectory . $fileName; move_uploaded_file($fileTmpName, $destination); // Insert file details into the database $uploadPercentage = 100; // Assuming 100% upload completion initially $sql = "INSERT INTO mp4 (mp4_name, mp4_date, mp4_category, mp4_title, urdu, english, thumbnail, upload_percentage) VALUES ('$fileName', NOW(), '$mp4_category', '$mp4_title', '$urdu', '$english', 'thumbnail_placeholder', $uploadPercentage)"; if ($conn->query($sql) === TRUE) { echo "File uploaded and details saved to database successfully!"; } else { echo "Error: " . $sql . "<br>" . $conn->error; } } else { echo "Error: File not uploaded."; } $conn->close(); ?>