Add file Description below filename, still need to work on the UI a bit

This commit is contained in:
johnnyq 2024-03-15 18:44:16 -04:00
parent 27a96c2293
commit cdd16bd460
3 changed files with 19 additions and 2 deletions

View File

@ -11,7 +11,19 @@
<input type="hidden" name="client_id" value="<?php echo $client_id; ?>">
<div class="modal-body bg-white">
<div class="form-group">
<label>Description</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-angle-right"></i></span>
</div>
<input type="text" class="form-control" name="description" placeholder="Description of the file">
</div>
</div>
<div class="form-group mb-4">
<label>Folder</label>
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fa fa-fw fa-folder"></i></span>

View File

@ -249,6 +249,7 @@ $num_of_files = mysqli_num_rows($sql);
while ($row = mysqli_fetch_array($sql)) {
$file_id = intval($row['file_id']);
$file_name = nullable_htmlentities($row['file_name']);
$file_description = nullable_htmlentities($row['file_description']);
$file_reference_name = nullable_htmlentities($row['file_reference_name']);
$file_ext = nullable_htmlentities($row['file_ext']);
if ($file_ext == 'pdf') {
@ -283,7 +284,10 @@ $num_of_files = mysqli_num_rows($sql);
<input class="form-check-input bulk-select" type="checkbox" name="file_ids[]" value="<?php echo $file_id ?>">
</div>
</td>
<td><a href="<?php echo "uploads/clients/$client_id/$file_reference_name"; ?>" target="_blank" class="text-secondary"><i class="fa fa-fw fa-2x fa-<?php echo $file_icon; ?> mr-3"></i> <?php echo basename($file_name); ?></a></td>
<td>
<a href="<?php echo "uploads/clients/$client_id/$file_reference_name"; ?>" target="_blank" class="text-secondary"><i class="fa fa-fw fa-2x fa-<?php echo $file_icon; ?> mr-3"></i><?php echo basename($file_name); ?></a>
<div class="mt-1"><small class="text-secondary"><?php echo $file_description; ?></small></div>
</td>
<td><?php echo $file_created_at; ?></td>
<td>
<div class="dropdown dropleft text-center">

View File

@ -7,6 +7,7 @@
if (isset($_POST['upload_files'])) {
$client_id = intval($_POST['client_id']);
$folder_id = intval($_POST['folder_id']);
$description = sanitizeInput($_POST['description']);
if (!file_exists("uploads/clients/$client_id")) {
mkdir("uploads/clients/$client_id");
@ -39,7 +40,7 @@ if (isset($_POST['upload_files'])) {
// Extract .ext from reference file name to be used to store SHA256 hash
$file_hash = strstr($file_reference_name, '.', true) ?: $file_reference_name;
mysqli_query($mysqli,"INSERT INTO files SET file_reference_name = '$file_reference_name', file_name = '$file_name', file_ext = '$file_extension', file_hash = '$file_hash', file_folder_id = $folder_id, file_client_id = $client_id");
mysqli_query($mysqli,"INSERT INTO files SET file_reference_name = '$file_reference_name', file_name = '$file_name', file_description = '$description', file_ext = '$file_extension', file_hash = '$file_hash', file_folder_id = $folder_id, file_client_id = $client_id");
//Logging
$file_id = intval(mysqli_insert_id($mysqli));