File size: 6,013 Bytes
e658d9c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>File Upload and Process</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
    <style>

        body {

            background-color: #1d2329;

            color: #e0e0e0;

            font-family: 'Arial', sans-serif;

        }



        .container {

            margin-top: 50px;

        }



        .card {

            background-color: #2a2f36;

            border: none;

            border-radius: 10px;

            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);

        }



        .card-header {

            background-color: #3a4149;

            color: white;

            border-top-left-radius: 10px;

            border-top-right-radius: 10px;

        }



        .btn-primary,

        .btn-success,

        .btn-info {

            border-radius: 50px;

            padding: 10px;

            width: 100%;

        }



        .btn-primary {

            background-color: #007bff;

            border: none;

        }



        .btn-success {

            background-color: #28a745;

            border: none;

        }



        .btn-info {

            background-color: #17a2b8;

            border: none;

        }



        .uploaded-file {

            margin-top: 15px;

            display: flex;

            align-items: center;

        }



        .uploaded-file span {

            font-size: 16px;

            margin-left: 10px;

            color: #e0e0e0;

        }



        .remove-file {

            cursor: pointer;

            color: #dc3545;

            margin-left: 10px;

        }



        .form-control-file {

            border-radius: 50px;

            border: 2px solid #4e5d6c;

            padding: 10px;

            background-color: #3a4149;

            color: #e0e0e0;

            font-size: 16px;

        }



        .form-control {

            border-radius: 50px;

            background-color: #3a4149;

            color: #e0e0e0;

            border: 2px solid #4e5d6c;

        }



        .mt-3 {

            margin-top: 20px !important;

        }



        .card-footer {

            text-align: center;

            border-top: 1px solid #4e5d6c;

            padding: 15px;

        }



        .custom-file-upload {

            border: 1px solid #4e5d6c;

            display: inline-block;

            padding: 6px 12px;

            cursor: pointer;

            border-radius: 50px;

            background-color: #3a4149;

            color: #e0e0e0;

        }



        .custom-file-upload input[type="file"] {

            display: none;

        }



        .form-group {

            margin-top: 20px;

        }



        #loadingSpinner {

            display: none;

            margin-top: 20px;

        }

    </style>
</head>

<body>
    <div class="container">
        <div class="row justify-content-center">
            <div class="col-md-8">
                <div class="card">
                    <div class="card-header text-center">
                        <h2>Upload and Process Files</h2>
                    </div>
                    <div class="card-body">
                        <form id="uploadForm" action="{{ url_for('upload_file') }}" method="post"

                            enctype="multipart/form-data">
                            <h4 class="text-center">Upload Images</h4>
                            <input type="file" name="files" multiple class="form-control-file" required>
                            <button type="submit" class="btn btn-primary mt-3">Upload</button>
                        </form>

                        {% if uploaded_files %}
                        <h4 class="mt-4">Uploaded Files:</h4>
                        <ul class="list-group">
                            {% for file in uploaded_files %}
                            <li class="list-group-item d-flex justify-content-between align-items-center"

                                style="background-color: #3a4149; color: #e0e0e0;">
                                {{ file }}
                                <a href="/remove_file" class="remove-file" title="Remove File">&times;</a>
                            </li>
                            {% endfor %}
                        </ul>
                        {% endif %}

                        <form id="processForm" method="post" action="/process" class="mt-3">
                            <button id="processBtn" type="submit" class="btn btn-success">Process All Files</button>
                        </form>

                        <div id="loadingSpinner" class="text-center">
                            <div class="spinner-border text-primary" role="status">
                                <span class="sr-only">Processing...</span>
                            </div>
                        </div>
                    </div>
                    <div class="card-footer">
                        <small>&copy; 2024 | Webashalar Pvt. Ltd.</small>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.4/dist/umd/popper.min.js"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>

    <script>

        document.getElementById("processForm").addEventListener("submit", function(event) {

            document.getElementById("loadingSpinner").style.display = "block";

            document.getElementById("processBtn").style.display = "none";

        });

    </script>
</body>

</html>