📁 File Manager
🏠 /
/
home
/
u857492117
/
domains
/
mangaldaicollege.org
/
public_html
/
adminpanel
Dosya Düzenle: addon_code.php
<?php session_start(); include 'connect.php'; if (isset($_SESSION['Dept_head'])){ $publisher=$_SESSION['Dept_head']; $dept = $_POST['deptName']; $did = $_POST['did']; $course_name = $_POST['courseName']; $c_details = $_POST['c_details']; $c_duration = $_POST['c_duration']; $fees = $_POST['fees']; $year = $_POST['year']; $intake = $_POST['intake']; $targetDir = 'D_upload/addon_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++; } $targetFilePath2 = $targetDir . $fileName; // Move the uploaded file to the target directory with the generated file name if(move_uploaded_file($_FILES['link']['tmp_name'], $targetFilePath2) ) { echo "Document uploaded yes"; } else { echo "noo"; } $targetDir = 'D_upload/addon_U/'; // Specify the target directory where the files will be uploaded $fileName = $_FILES['banner']['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['banner']['tmp_name'], $targetFilePath) ) { echo "Document uploaded yes"; } else { echo "noo"; } // Now $targetFilePath contains the path to the uploaded file with the generated name echo $sql1 = "insert into addon values(NULL,'$course_name','$c_details','$c_duration','$fees','$did','$dept','$intake','$targetFilePath','$targetFilePath2','$year','$publisher')"; if(mysqli_query($con,$sql1)){ header('location:add_addon.php'); } else{ echo "something error"; } //}else{ // echo "You are Not Authorize" } ?>
💾 Kaydet
İptal