2025-01-05 21:35:38 +00:00
< ? php
/*
* upload - file . php
* Upload2USB App - Process Submission
*/
include ( " upload2usb.php " );
2025-01-06 03:48:19 +00:00
//get folder path where file will be stored
2025-01-05 21:35:38 +00:00
$target_folder_path = getTargetFolderPath ( 1 );
2025-01-06 03:48:19 +00:00
$target_file = $target_folder_path . " / " . basename ( $_FILES [ " uploaded_file " ][ " name " ]);
2025-01-05 21:35:38 +00:00
$upload_ok = 1 ;
$upload_msg = " " ;
2025-01-06 03:48:19 +00:00
if ( ! isset ( $_POST [ " submit " ]) || empty ( basename ( $_FILES [ " uploaded_file " ][ " name " ]))) {
2025-01-05 21:35:38 +00:00
$upload_msg = " No file submitted. " ;
$upload_ok = 0 ;
} elseif ( file_exists ( $target_file )) {
$upload_msg = " This file already exists. " ;
$upload_ok = 0 ;
}
// Check if $upload_ok is set to 0 by an error
if ( $upload_ok == 0 ) {
$upload_msg = " ❌ Your file was not uploaded. " . $upload_msg ;
// if everything is ok, try to upload file
} else {
2025-01-06 03:48:19 +00:00
if ( move_uploaded_file ( $_FILES [ " uploaded_file " ][ " tmp_name " ], $target_file )) {
$upload_msg = " 😊 ✅ Your file <span style= \" font-weight:bold; font-style:italic; \" > " . htmlspecialchars ( basename ( $_FILES [ " uploaded_file " ][ " name " ])) . " </span> was successfully uploaded! " ;
2025-01-05 21:35:38 +00:00
} else {
$upload_msg = " ❌ There was an error uploading your file. " . $upload_msg ;
}
}
$file_count = getFileCount ( $target_folder_path )
?>
<! DOCTYPE html >
< html >
< head >
2025-01-06 03:48:19 +00:00
< title > IIAB Upload to USB App </ title >
2025-01-05 21:35:38 +00:00
< meta http - equiv = " content-type " content = " text/html; charset=UTF-8 " >
< meta name = " viewport " content = " width=device-width, initial-scale=1 " >
< link rel = " stylesheet " href = " /common/css/bootstrap4.min.css " />
< link rel = " stylesheet " href = " /common/css/fa.all.min.css " />
< link rel = " stylesheet " href = " /common/css/font-faces.css " />
< script src = " /common/js/jquery.min.js " ></ script >
< script src = " /common/js/bootstrap4.min.js " ></ script >
</ head >
< body class = " text-center " style = " background-color:#f5f5f5; " >
< div id = " container " class = " container " >
< div class = " row " >
< div class = " col-sm-6 offset-sm-3 text-center " style = " padding:15px; " >
2025-01-08 10:45:00 +00:00
< img class = " mb-4 " src = " uk-swing.png " alt = " " width = " 75 " >
2025-01-06 03:48:19 +00:00
< h1 class = " h3 mb-3 font-weight-normal " > Internet in a Box Upload to USB </ h1 >
2025-01-05 21:35:38 +00:00
< ? php echo $upload_msg ?> <br/>
2025-01-06 03:48:19 +00:00
< ? php echo $file_count ?> files have been submitted today!
2025-01-05 21:35:38 +00:00
</ div >
</ div >
</ div >
</ body >
</ html >