fdropper 0.0.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ Metadata-Version: 2.5
2
+ Name: fdropper
3
+ Version: 0.0.1
4
+ Summary: A file uploader with frontend that can upload files directly to a share
5
+ Author: Reece Williams
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Dist: flask
9
+ Requires-Dist: gunicorn
@@ -0,0 +1,5 @@
1
+ fdropper.py,sha256=4bOpy1yQk6zP9FOVgpkWHrKKog7dxYD5vK0B0dJYkBU,1609
2
+ fdropper-0.0.1.dist-info/METADATA,sha256=8llQF__wqZSKCTHAW7TkvkClxk4v31-HhtZGe46LsRg,247
3
+ fdropper-0.0.1.dist-info/WHEEL,sha256=fHPnMKWT89FZW0T1fTFaTHGFCiqM06DSNuv4rFWJ6dc,105
4
+ fdropper-0.0.1.dist-info/licenses/LICENSE,sha256=BODjGJSsBWUvZcZzzOOpnZdcbj7Us6uILd4TX-hsn9Y,1096
5
+ fdropper-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.3
3
+ Root-Is-Purelib: true
4
+ Tag: py2-none-any
5
+ Tag: py3-none-any
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) [2026] [Reece Williams]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
fdropper.py ADDED
@@ -0,0 +1,47 @@
1
+ import os
2
+ from flask import Flask, jsonify, render_template, request
3
+ from werkzeug.utils import secure_filename
4
+
5
+ UPLOAD_FOLDER = 'uploads'
6
+
7
+ app = Flask(__name__)
8
+ app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
9
+ app.config['SECRET_KEY'] = 'your_very_secret_key'
10
+
11
+ if not os.path.exists(UPLOAD_FOLDER):
12
+ os.makedirs(UPLOAD_FOLDER)
13
+
14
+ @app.route('/', methods=['GET', 'POST'])
15
+ def upload_file():
16
+ if request.method == 'POST':
17
+ if 'file' not in request.files:
18
+ return jsonify(error='No files were included in the request.'), 400
19
+
20
+ files = request.files.getlist('file')
21
+ files = [file for file in files if file.filename]
22
+ if not files:
23
+ return jsonify(error='No files selected.'), 400
24
+
25
+ uploaded_files = []
26
+ for file in files:
27
+ filename = secure_filename(file.filename)
28
+ if not filename:
29
+ continue
30
+
31
+ base, extension = os.path.splitext(filename)
32
+ destination = os.path.join(app.config['UPLOAD_FOLDER'], filename)
33
+ counter = 1
34
+ while os.path.exists(destination):
35
+ filename = f'{base}_{counter}{extension}'
36
+ destination = os.path.join(app.config['UPLOAD_FOLDER'], filename)
37
+ counter += 1
38
+
39
+ file.save(destination)
40
+ uploaded_files.append(filename)
41
+
42
+ if not uploaded_files:
43
+ return jsonify(error='No valid filenames were supplied.'), 400
44
+
45
+ return jsonify(message='Files uploaded successfully.', files=uploaded_files), 201
46
+
47
+ return render_template('index.html',)