Skip to content

Commit

Permalink
Get File Extension
Browse files Browse the repository at this point in the history
  • Loading branch information
jggj21 authored Aug 17, 2024
1 parent 86b7a02 commit 951c280
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resources/views/tasks.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<td class="table-text">
<div>
@if($task->file_path)
<button type="button" class="btn btn-info btn-sm preview-file" data-file-url="{{ Storage::disk('azure')->temporaryUrl($task->file_path, now()->addMinutes(5)) }}">
<button type="button" class="btn btn-info btn-sm preview-file" data-file="{{$task->file_path}}" data-file-url="{{ Storage::disk('azure')->temporaryUrl($task->file_path, now()->addMinutes(5)) }}">
Preview
</button>
@else
Expand Down Expand Up @@ -129,7 +129,8 @@
previewButtons.forEach(button => {
button.addEventListener('click', function () {
const fileUrl = this.getAttribute('data-file-url');
const fileExtension = fileUrl.split('.').pop().toLowerCase();
const fileGetExt = this.getAttribute('data-file');
const fileExtension = fileGetExt.split('.').pop().toLowerCase();
const previewContainer = document.getElementById('filePreviewContainer');
Expand Down

0 comments on commit 951c280

Please sign in to comment.