📁 File Manager
🏠 /
/
home
/
u857492117
/
domains
/
mangaldaicollege.org
/
public_html
/
adminpanel
Dosya Düzenle: d_sadd_code.php
<?php session_start(); include 'connect.php'; if (isset($_SESSION['Dept_head'])){ $publisher=$_SESSION['Dept_head']; $dept = $_POST['deptName']; $did = $_POST['did']; $course = $_POST['course']; $subject = $_POST['subject']; $topic = $_POST['topic']; $sem=$_POST['sem']; $type = $_POST['type']; $date = $_POST['date']; $targetDir = 'D_upload/study_U/'; // Specify the target directory where the files will be uploaded $fileName = $_FILES['link']['name']; // Get the original file name // Generate a unique file name $counter = 1; while (file_exists($targetDir . $fileName)) { $fileName = pathinfo($fileName, PATHINFO_FILENAME) . '_' . $counter . '.' . pathinfo($fileName, PATHINFO_EXTENSION); $counter++; } $targetFilePath = $targetDir . $fileName; // Move the uploaded file to the target directory with the generated file name if(move_uploaded_file($_FILES['link']['tmp_name'], $targetFilePath) ) { echo "Document uploaded yes"; } else { echo "noo"; } $sql1 = "INSERT INTO study VALUES('$_POST[null]','$course','$subject','$topic','$sem','$type','$dept','$targetFilePath','$date','$did','$publisher')"; if(mysqli_query($con,$sql1)){ header('location:add_study.php'); } else{ echo "something error"; } //}else{ // echo "You are Not Authorize" } ?>
💾 Kaydet
İptal