Question: 0 ) { $message = You have already submitted an excuse for this course.; } else { if ( ! is _ dir ( $targetDir
$message "You have already submitted an excuse for this course.";
else
if isdir$targetDir
mkdir$targetDir, true;
name of ex
$fileName isset$FILESexcusefile"name uniqid basename$FILESexcusefile"name : ;
$targetFilePath $targetDir $fileName;
if empty$FILESexcusefile"name
$fileType strtolowerpathinfo$targetFilePath, PATHINFOEXTENSION;
$allowedTypes pdfjpgpng "jpeg";
$maxFileSize ;
if inarray$fileType, $allowedTypes
if $FILESexcusefile"size $maxFileSize
if $conn
$stmt mysqliprepare$conn, "INSERT INTO excuses scheduleID fileName, status, studentID VALUES ;
mysqlistmtbindparam$stmtssss $scheduleID, $fileName, $status, $studentID;
$executeResult mysqlistmtexecute$stmt;
if $executeResult && moveuploadedfile$FILESexcusefile"tmpname" $targetFilePath
$message "Excuse successfully submitted!";
echo
alertExcuse successfully submitted!;
window.location.href 'viewexamschedule.php;
;
exit;
else
$message "There was an error uploading the file or submitting the excuse.";
mysqlistmtclose$stmt;
else
$message "Database connection failed.";
else
$message "File size exceeds the allowed limit MB;
else
$message "Unsupported file format. Allowed formats: pdf jpg png;
else
$message "Please attach a file.";
i need to assign schudualID and StudentID by defult not to make user entered
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
