summaryrefslogtreecommitdiff
path: root/resources/views/files/upload.blade.php
blob: 7d5fdd2a6de7225e83fb2a9be7d6c37f1d9a4088 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@extends('template')

@section('content')

<section>
    <h5>File Upload</h5>
    <h6><a href="{{ route('files.browse') }}">Browse Uploaded Files</a></h6>

    <!-- Success Messages -->
    @if(session('success'))
        <div style="background-color: #d4edda; border: 1px solid #c3e6cb; color: #155724; padding: 10px; margin-bottom: 15px;">
            <strong>{{ session('success') }}</strong>
            @if(session('urls'))
                <div style="margin-top: 10px;">
                    <strong>Download URLs:</strong>
                    <ul>
                        @foreach(session('urls') as $url)
                            <li><a href="{{ $url }}">{{ $url }}</a></li>
                        @endforeach
                    </ul>
                </div>
            @endif
        </div>
    @endif

    <!-- Error Messages -->
    @if($errors->any())
        <div style="background-color: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; padding: 10px; margin-bottom: 15px;">
            <ul>
                @foreach($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif

    <div class="widget">
        <!-- Upload Form (Works without JS) -->
        <form id="uploadForm"
              action="{{ route('files.upload') }}"
              method="POST"
              enctype="multipart/form-data">
            @csrf

            <div style="margin-bottom: 15px;">
                <label for="files" style="display: block; margin-bottom: 5px;">
                    <strong>Choose Files</strong>
                </label>
                <input type="file"
                       name="f[]"
                       id="files"
                       multiple
                       accept=".{{ implode(',.', $allowedExtensions) }}"
                       style="width: 100%; padding: 5px;">
                <p style="font-size: 0.85em; color: #525252; margin-top: 5px;">
                    <strong>Max size:</strong> {{ $maxSizeMB }}MB per file<br>
                    <strong>Max files:</strong> {{ $maxFiles }}<br>
                    <strong>Allowed types:</strong> {{ implode(', ', $allowedExtensions) }}
                </p>
            </div>

            <!-- Progress bar (hidden initially, shown by JS) -->
            <div id="uploadProgress" style="display: none; margin-bottom: 15px;">
                <div style="width: 100%; background-color: #ddd; height: 20px; border: 1px solid #999;">
                    <div id="progressBar" style="width: 0%; background-color: #4CAF50; height: 100%;"></div>
                </div>
                <p id="progressText" style="font-size: 0.85em; margin-top: 5px;"></p>
            </div>

            <button type="submit" style="padding: 8px 16px; background-color: #333; color: #fff; border: none; cursor: pointer;">
                Upload
            </button>
        </form>
    </div>

    <!-- Results container for AJAX uploads -->
    <div id="uploadResults" style="display: none;"></div>
</section>

<footer>
    <p>Last updated December 28th, 2025</p>
</footer>

@endsection

@section('scripts')
@vite(['resources/js/chunked-upload.js'])
@endsection