Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .gitignore
Empty file.
Binary file added __pycache__/app.cpython-314.pyc
Binary file not shown.
Binary file added __pycache__/config.cpython-314.pyc
Binary file not shown.
Binary file added __pycache__/extensions.cpython-314.pyc
Binary file not shown.
39 changes: 39 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import os
import logging
from flask import Flask
from config import Config
from extensions import db # db is now imported from extensions.py
from dotenv import load_dotenv

# Load environment variables
load_dotenv()

def create_app():
app = Flask(__name__)
app.config.from_object(Config)

# Initialize extensions
db.init_app(app)

# Logging setup
os.makedirs(app.config['LOG_FOLDER'], exist_ok=True)
logging.basicConfig(
filename=f"{app.config['LOG_FOLDER']}/app.log",
level=logging.INFO,
format='%(asctime)s [%(levelname)s] %(message)s'
)

# Register blueprints
from controllers.file_controller import file_bp
app.register_blueprint(file_bp)

# Create database tables
with app.app_context():
db.create_all()

return app

# Run the app
if __name__ == '__main__':
app = create_app()
app.run(debug=True)
14 changes: 14 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
from dotenv import load_dotenv

load_dotenv()

class Config:
SQLALCHEMY_DATABASE_URI = (
f"mysql+pymysql://{os.getenv('DB_USER')}:{os.getenv('DB_PASSWORD')}@"
f"{os.getenv('DB_HOST')}:{os.getenv('DB_PORT')}/{os.getenv('DB_NAME')}"
)
SQLALCHEMY_TRACK_MODIFICATIONS = False
UPLOAD_FOLDER = os.getenv('UPLOAD_FOLDER', 'uploads')
LOG_FOLDER = 'logs'
DEBUG = True
Binary file not shown.
61 changes: 61 additions & 0 deletions controllers/file_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
from flask import Blueprint, request, jsonify, send_file, current_app
from services.file_service import save_file, update_file, delete_file
from models.uploaded_file import UploadedFile
import uuid
import logging

file_bp = Blueprint('file_bp', __name__)

@file_bp.route('/upload', methods=['POST'])
def upload_file():
try:
if 'file' not in request.files:
return jsonify({'message': 'No file uploaded'}), 400

file = request.files['file']
folder = f"{current_app.config['UPLOAD_FOLDER']}/{uuid.uuid4().hex}"
upload_file = save_file(file, folder)

return jsonify({'message': 'Upload successfull', 'id': upload_file.id, 'path': upload_file.file_path}), 201

except Exception as e:
logging.error(f"Upload error: {e}")
return jsonify({'message': str(e)}), 400


@file_bp.route('/file/<int:file_id>', methods=['GET'])
def get_file(file_id):
try:
file = UploadedFile.query.get(file_id)
if not file:
return jsonify({'message': 'File not found'}), 404

return send_file(file.file_path, as_attachment=True)
except Exception as e:
logging.error(f"Get error: {e}")
return jsonify({'message': str(e)}), 400


@file_bp.route('/file/<int:file_id>', methods=['PUT'])
def update_existing_file(file_id):
try:
if 'file' not in request.files:
return jsonify({'message': 'No file provided'}), 400

file = request.files['file']
updated = update_file(file_id, file, current_app.config['UPLOAD_FOLDER'])

return jsonify({'message': 'File updated successfully', 'path': updated.file_path}), 200

except Exception as e:
logging.error(f"Update error: {e}")
return jsonify({"message": str(e)}), 400

@file_bp.route('/file/<int:file_id>', methods=['DELETE'])
def delete_existing_file(file_id):
try:
deleted = delete_file(file_id)
return jsonify({'message': 'File deleted successfully'}), 200
except Exception as e:
logging.error(f"Delete error: {e}")
return jsonify({'message': str(e)}), 400
3 changes: 3 additions & 0 deletions extensions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from flask_sqlalchemy import SQLAlchemy

db = SQLAlchemy()
90 changes: 90 additions & 0 deletions logs/app.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
2025-10-19 00:24:29,307 [INFO] WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
2025-10-19 00:24:29,308 [INFO] Press CTRL+C to quit
2025-10-19 00:24:29,315 [INFO] * Restarting with stat
2025-10-19 00:24:31,078 [WARNING] * Debugger is active!
2025-10-19 00:24:31,094 [INFO] * Debugger PIN: 311-512-146
2025-10-19 00:27:10,978 [INFO] WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
2025-10-19 00:27:10,978 [INFO] Press CTRL+C to quit
2025-10-19 00:27:10,983 [INFO] * Restarting with stat
2025-10-19 00:27:12,750 [WARNING] * Debugger is active!
2025-10-19 00:27:12,779 [INFO] * Debugger PIN: 384-618-670
2025-10-19 00:29:28,633 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:29:28] code 400, message Bad request version ('\x8d\x19�\x92@p�泺���\x83\x02,x~\x8cr%')
2025-10-19 00:29:28,641 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:29:28] code 400, message Bad request version ('*')
2025-10-19 00:29:28,662 [INFO] 127.0.0.1 - - [19/Oct/2025 00:29:28] "\x16\x03\x01\x07\x12\x01\x00\x07\x0e\x03\x03W\x94ihYn�\x07��\x1b��z!�5rV��\x88\x01�\x1eC�\x06�\x0b* " 400 -
2025-10-19 00:29:28,661 [INFO] 127.0.0.1 - - [19/Oct/2025 00:29:28] "\x16\x03\x01\x06�\x01\x00\x06�\x03\x03��91�,\x1bi\x17&��\x1ezߵ�V�@\x1fq�9�iPY�I\x8b �M��!s�\x9e���0�\x88\x0bZ\x82�\x83�\x9eQ\x90\x15�\x05��\x0c���\x00 zz\x13\x01\x13\x02\x13\x03�+�/�,�0̨̩�\x13�\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x06\x85��\x00\x00Di\x00\x05\x00\x03\x02h2�\x01\x00\x01\x00\x00#\x00\x00\x00\x12\x00\x00�\x0d\x00�\x00\x00\x01\x00\x01\x17\x00 5|6\x16��\x9f��$<S�\x00���zb��)\x17T�\x9d ���>\x00��\x00Xq.��3KKW\x89-t������\x1d`�$J�\x8e\x8bP�\x1a�h\x96�6\x8fZV�C/k}h�N�j'��?\x19Fa\\�X�\x93�޲��E�5o�j:\x92�\x03G�]�='*\x12\x18"/�Yu\x1f\x8d\x19�\x92@p�泺���\x83\x02,x~\x8cr%" 400 -
2025-10-19 00:29:28,709 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:29:28] code 400, message Bad request version ('\x8a\x8a\x00\x00\x00')
2025-10-19 00:29:28,709 [INFO] 127.0.0.1 - - [19/Oct/2025 00:29:28] "\x16\x03\x01\x06�\x01\x00\x06�\x03\x03�\x9ca�xi\x97>�U.\x97��\x08��%���g\x16�\x8f���H �\x97 �\x14\x9f\x06\x0b\x09��\x17U#�\x84�\x02�)ī����i���{\x00 jj\x13\x01\x13\x02\x13\x03�+�/�,�0̨̩�\x13�\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x06\x85\x8a\x8a\x00\x00\x00" 400 -
2025-10-19 00:29:28,991 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:29:28] code 400, message Bad request version ('\x02h2\x08http/1.1\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00#\x00\x00�\x01\x00\x01\x00\x00')
2025-10-19 00:29:28,991 [INFO] 127.0.0.1 - - [19/Oct/2025 00:29:28] "\x16\x03\x01\x06�\x01\x00\x06�\x03\x03��"U7R6e\x1f�p.�:�2\x82q�\x9f�\x7f��Y�E\x06ʯ\x1c\x84 v��\x87\x9a����;g�V)\x7f�p\x84\x82��\x92\x1d ��u�eC�\x00 ��\x13\x01\x13\x02\x13\x03�+�/�,�0̨̩�\x13�\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x06E��\x00\x00\x00\x17\x00\x00\x00\x10\x00\x0e\x00\x0c\x02h2\x08http/1.1\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00#\x00\x00�\x01\x00\x01\x00\x00" 400 -
2025-10-19 00:29:28,999 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:29:28] code 400, message Bad request version ("Ĭy\x88DTJr\x82�a�'\x137�")
2025-10-19 00:29:29,014 [INFO] 127.0.0.1 - - [19/Oct/2025 00:29:29] "\x16\x03\x01\x06�\x01\x00\x06�\x03\x03ó\x15f|\x0e�L\x1b�\x1e.V�\x91\x08\x10訯U%>\x1fֵf=���# �z\x8a[Ũ\x81�.\x16g\x8a\x15\x96\x99n�+RRN\x1a}\x9d\x95m\x9fU$q\x15G\x00 \x8a\x8a\x13\x01\x13\x02\x13\x03�+�/�,�0̨̩�\x13�\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x06\x85::\x00\x00�\x0d\x00�\x00\x00\x01\x00\x01\x16\x00 B�3�O�5R�n�F̲{�x\x00a}�\x9a�\x0bDC��\x18F�\x1a\x00�~$�\x05�\x9d�\x9fI���]\x1a��\x9bh��\x83��\x126�n\x08�\x1dx\x05\x7f\x06��#\x09�\\O6�\x8e ��\x98��kc\x0dṴ�n]s9Ki\x8d\x00 b\x0b=\x99��?�y\x08~�7�M�\x8eO��\x91,Y�y�S�Ho\x92\x15�'��+%���\x0d4���N\x1a�*\x04G7��!~\x96\x0f\x82�6I\x88wO5��\x0b��t����7--����F\x90\x10�\x07B�\x87\x05��ak��\x1d\x81RU\x1c�\x93\x9e\x1c=����\x94��\x15�\x9eL�\x99�W\x0ei/*\x1bY\x89m�ک6P\x17\x00#\x00\x00\x00\x17\x00\x00\x003\x04�\x04�zz\x00\x01\x00\x11�\x04��E\x0bVV1\x8bU\x8e"g^\x17�\x9e�@\x87!�\x09\x88�&�e'�\x85\x86!�#\x0c\x09f_ZT\\{\x19��+\x9f\x96#\x1a�i�\x89v��d|�v��F\x87�\x9f�ׯ\\6\x88�k\x84Ep\x0e\x14��\x1eĬy\x88DTJr\x82�a�'\x137�" 400 -
2025-10-19 00:29:29,026 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:29:29] code 400, message Bad request version ('localhost\x00\x12\x00\x00�\x01\x00\x01\x00Di\x00\x05\x00\x03\x02h2\x00')
2025-10-19 00:29:29,026 [INFO] 127.0.0.1 - - [19/Oct/2025 00:29:29] "\x16\x03\x01\x06�\x01\x00\x06�\x03\x03�2\x03q;��\x01Ż�.��4s��*�\x06V�Aͷ�\x00\x118�\x15 \x97��\x90�U�lw�<R�\x10�\x1b��_\x06mX�³5r�ٻ�\x9e\x00 JJ\x13\x01\x13\x02\x13\x03�+�/�,�0̨̩�\x13�\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x06e\x9a\x9a\x00\x00\x00\x1b\x00\x03\x02\x00\x02\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00\x10\x00\x0e\x00\x0c\x02h2\x08http/1.1\x00\x0b\x00\x02\x01\x00\x00\x00\x00\x0e\x00\x0c\x00\x00\x09localhost\x00\x12\x00\x00�\x01\x00\x01\x00Di\x00\x05\x00\x03\x02h2\x00" 400 -
2025-10-19 00:32:22,055 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:32:22] code 400, message Bad request version ('�\x13�')
2025-10-19 00:32:22,055 [INFO] 127.0.0.1 - - [19/Oct/2025 00:32:22] "\x16\x03\x01\x00�\x01\x00\x00�\x03\x03��(\\���iX�ʽ?�\x12��uc�۩�k\x9a+\x9dF��\x1b\x09 �H&z4�\x18�\x07e�\x07��\x144\x16�:���f\x8d\x86,�\x84�i\x10\x00$\x13\x01\x13\x02\x13\x03�/�+�0�,�'̨̩�\x09�\x13�" 400 -
2025-10-19 00:34:12,176 [INFO] WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
2025-10-19 00:34:12,176 [INFO] Press CTRL+C to quit
2025-10-19 00:34:12,182 [INFO] * Restarting with stat
2025-10-19 00:34:13,680 [WARNING] * Debugger is active!
2025-10-19 00:34:13,697 [INFO] * Debugger PIN: 384-618-670
2025-10-19 00:36:00,887 [INFO] WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
2025-10-19 00:36:00,887 [INFO] Press CTRL+C to quit
2025-10-19 00:36:00,892 [INFO] * Restarting with stat
2025-10-19 00:36:02,366 [WARNING] * Debugger is active!
2025-10-19 00:36:02,377 [INFO] * Debugger PIN: 384-618-670
2025-10-19 00:38:09,773 [INFO] WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on http://127.0.0.1:5000
2025-10-19 00:38:09,774 [INFO] Press CTRL+C to quit
2025-10-19 00:38:09,777 [INFO] * Restarting with stat
2025-10-19 00:38:11,142 [WARNING] * Debugger is active!
2025-10-19 00:38:11,150 [INFO] * Debugger PIN: 384-618-670
2025-10-19 00:38:35,027 [INFO] 127.0.0.1 - - [19/Oct/2025 00:38:35] "GET / HTTP/1.1" 404 -
2025-10-19 00:38:35,364 [INFO] 127.0.0.1 - - [19/Oct/2025 00:38:35] "GET /favicon.ico HTTP/1.1" 404 -
2025-10-19 00:43:22,751 [INFO] 127.0.0.1 - - [19/Oct/2025 00:43:22] "POST /upload HTTP/1.1" 400 -
2025-10-19 00:48:29,981 [INFO] File saved: uploads/6fbae549c57c4fba9a9dc932ca0f659f\43fd18bbebc847888e1e02dcdbe1fb8e_me_fr_this_year.jpg
2025-10-19 00:48:30,046 [INFO] 127.0.0.1 - - [19/Oct/2025 00:48:30] "POST /upload HTTP/1.1" 201 -
2025-10-19 00:48:42,386 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:48:42] code 400, message Bad request version ('(�k\x04\x9e\\')
2025-10-19 00:48:42,397 [INFO] 127.0.0.1 - - [19/Oct/2025 00:48:42] "\x16\x03\x01\x06�\x01\x00\x06�\x03\x03��C0� r\x1d8�9\x9dZe�ש�.� 6\x8ee\x83�\x1b�\x1b�0� ���WP!\x93��e\x90�X�\x1d\x1e���Hϩ\x83��b\x83x\x9d<��\x00 \x8a\x8a\x13\x01\x13\x02\x13\x03�+�/�,�0̨̩�\x13�\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x06e��\x00\x00\x00\x05\x00\x05\x01\x00\x00\x00\x00�\x0d\x00�\x00\x00\x01\x00\x01�\x00 e\x10\x83V;_�\x84\x19A�\x1a�\x0b�\x857�S۷\x88�C�5�\x10�\x92\x85s\x00�U�p�\x1f�\x08&,�\x08\x04�\x8c(z���E\x11�m�\x90���֪�g�A\x96\x16m�|�\x0c:�\x83�\x1e5�%s�\x11�\x90k�K})\x18�\x9c\x8a\x13l\x8b��k�\x9b�\x1d\x98�5C��\x94\x1c\x9a�\x9d��\x12\x18\x935�\x0f\x9aI\x1c(�k\x04\x9e\\" 400 -
2025-10-19 00:48:42,401 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:48:42] code 400, message Bad request version ('\x02h2\x08http/1.1\x00+\x00\x07\x06')
2025-10-19 00:48:42,401 [INFO] 127.0.0.1 - - [19/Oct/2025 00:48:42] "\x16\x03\x01\x06�\x01\x00\x06�\x03\x03'n&�\x1e\x95\x0fX\x9c{\x0e��\\�е�\x15��\x08�8�\x04Li\x954�T �\x9d�\x0el���-�S\\'��\x08\x94���'�ݱAvk�\x1f��\x19\x00 zz\x13\x01\x13\x02\x13\x03�+�/�,�0̨̩�\x13�\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x06e��\x00\x00\x00\x12\x00\x00\x00\x10\x00\x0e\x00\x0c\x02h2\x08http/1.1\x00+\x00\x07\x06" 400 -
2025-10-19 00:48:42,457 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:48:42] code 400, message Bad request version ('localhost\x00')
2025-10-19 00:48:42,457 [INFO] 127.0.0.1 - - [19/Oct/2025 00:48:42] "\x16\x03\x01\x06�\x01\x00\x06�\x03\x036��\x88h\x8e\x8a+>�6\x8fĸ\x09\x9a1\x18\x1en\x10\x95\x0c+~\x12g"z��\x93 �2��\x8aF\x8a\x08�UJ�\x1d\x91��\x9f�\x12l#\x12ij�/K\x86�Ků\x00 ��\x13\x01\x13\x02\x13\x03�+�/�,�0̨̩�\x13�\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x06E��\x00\x00\x00\x1b\x00\x03\x02\x00\x02\x00\x10\x00\x0e\x00\x0c\x02h2\x08http/1.1�\x01\x00\x01\x00\x00-\x00\x02\x01\x01\x00\x00\x00\x0e\x00\x0c\x00\x00\x09localhost\x00" 400 -
2025-10-19 00:48:42,731 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:48:42] code 400, message Bad request version ('\x02h2\x08http/1.1\x00\x12\x00\x00\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00+\x00\x07\x06��\x03\x04\x03\x03\x003\x04�\x04�')
2025-10-19 00:48:42,738 [INFO] 127.0.0.1 - - [19/Oct/2025 00:48:42] "\x16\x03\x01\x06�\x01\x00\x06�\x03\x03��w��\x80p\x87�Q\x99R\x03]V�\x09�-s\x1dLԳ�\x9f+�\x1e\x99�\x03 m\x05kC76`�>��=v��\x1c�\x19{.�\x94ZBW��6�}�\x00 ��\x13\x01\x13\x02\x13\x03�+�/�,�0̨̩�\x13�\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x06\x85��\x00\x00\x00-\x00\x02\x01\x01�\x01\x00\x01\x00\x00\x1b\x00\x03\x02\x00\x02\x00\x00\x00\x0e\x00\x0c\x00\x00\x09localhost�\x0d\x00�\x00\x00\x01\x00\x01p\x00 �\x00\x00\x02i|r{.�ӯ/ݩ]!Q\x0f�OG-�\x1a\x88}\x98=\x89\x9e\x0b\x00д\x95\x82#���`WL=�\x9cx>�\x1b���\x86��k�D˲>\x18բ<GR��)�\x13DH"\x11�}߭�F�J\x9f_\x06\x12\x16YZ\x11D��6<\x0e�j$�\x1d\x9c\x10Km�mr�\x90\x12�=\x01��;\x04-\x8c({�x{\x8b�Pb�\x0d��kM�n1��gA\x1a\x1f�Fl?��%�\x13V�F�\x86\x95��j��\x9fd���c\x7fV=\x1d��z3\x80�#���\x08�\x97<\x0e<�e\x8c=����\x99\x16��:\x0f�8g0s\x08]\x9c�m���\x9b�Ŀ4\x13aw|N��\x87-\x91ve\x90\x06\x91\x00\x17\x00\x00\x00\x0b\x00\x02\x01\x00\x00\x0d\x00\x12\x00\x10\x04\x03\x08\x04\x04\x01\x05\x03\x08\x05\x05\x01\x08\x06\x06\x01\x00\x10\x00\x0e\x00\x0c\x02h2\x08http/1.1\x00\x12\x00\x00\x00\x05\x00\x05\x01\x00\x00\x00\x00\x00+\x00\x07\x06��\x03\x04\x03\x03\x003\x04�\x04�" 400 -
2025-10-19 00:48:42,741 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:48:42] code 400, message Bad request version ('"\x1a\x9a�Q')
2025-10-19 00:48:42,744 [INFO] 127.0.0.1 - - [19/Oct/2025 00:48:42] "\x16\x03\x01\x07\x12\x01\x00\x07\x0e\x03\x03\x16\x98�'oI��|)�l^�b�\\�W1\x0f\x88�\x14~�l\x17\x85A� ���\x8f�l�0uI�/�0�\x8f_et��\x90�`��n\x1dC\x80G�\x00 zz\x13\x01\x13\x02\x13\x03�+�/�,�0̨̩�\x13�\x14\x00\x9c\x00\x9d\x00/\x005\x01\x00\x06�\x1a\x1a\x00\x00\x00\x1b\x00\x03\x02\x00\x02\x00+\x00\x07\x06JJ\x03\x04\x03\x03\x003\x04�\x04�::\x00\x01\x00\x11�\x04��\x10\x0d\x04\x9b.��4�4\x01�x�`W�\x16I\x1d%���\x99\x9c�\x06_��A0`2�X\x10�;\x1br\x88a�L\x13R��\x10U\x1f\x9d6\x03"\x92�$����\x10\x8a�\x1a�c\x06\x06�\x09ȧj�q�Ccr7��\x0f��C\x096IJ�\x9b��d;\x9d�SGe\x10�\x0f�k6\x09a\x99\x9bUz�q��o\x9a\x99J2�N}�\x97�j\x1e%�\x17��p<�\x95�k�\\�Z�E��0`\x86t \x9f8.�H3i����!�\x8a\x1e\x95�qx�\x0c\\,\x0bU��C�{\x92y\x87�\x9c���\x85\x00S��\x99\x0c|�aE\x84\x83q�,<�'�\x92<�)�s�\x09"\x1a\x9a�Q" 400 -
2025-10-19 00:48:42,776 [ERROR] 127.0.0.1 - - [19/Oct/2025 00:48:42] code 400, message Bad request version ('M�H\x8f:!���;\x02\x8f\x7f��\x98���\x98')
2025-10-19 00:48:42,776 [INFO] 127.0.0.1 - - [19/Oct/2025 00:48:42] "\x16\x03\x01\x06�\x01\x00\x06�\x03\x03�l5�O\x7f�an�\x95\x94\x19�\x9f�ĺ\x8ar9�\x9f�\x83i\x1ft��s\x01 7K��F��\x0cM�H\x8f:!���;\x02\x8f\x7f��\x98���\x98" 400 -
2025-10-19 00:48:48,067 [INFO] 127.0.0.1 - - [19/Oct/2025 00:48:48] "GET / HTTP/1.1" 404 -
2025-10-19 00:48:50,092 [INFO] 127.0.0.1 - - [19/Oct/2025 00:48:50] "GET / HTTP/1.1" 404 -
2025-10-19 00:50:27,963 [INFO] 127.0.0.1 - - [19/Oct/2025 00:50:27] "GET / HTTP/1.1" 404 -
2025-10-19 00:54:34,588 [INFO] 127.0.0.1 - - [19/Oct/2025 00:54:34] "GET /upload HTTP/1.1" 405 -
2025-10-19 00:54:54,391 [INFO] File saved: uploads/48bfc73ff9164c00bec884c44ac78f6d\a831989336bc450abac0986e92484125_I_Love_Taylor_Swift.jpg
2025-10-19 00:54:54,422 [INFO] 127.0.0.1 - - [19/Oct/2025 00:54:54] "POST /upload HTTP/1.1" 201 -
2025-10-19 00:56:07,388 [INFO] 127.0.0.1 - - [19/Oct/2025 00:56:07] "POST /upload HTTP/1.1" 400 -
2025-10-19 00:56:14,701 [INFO] File saved: uploads/daf0ba4bdc3c428e985393018aecec19\8f36907cbb54423198a2f1c0dea0c380_taytay.jpg
2025-10-19 00:56:14,704 [INFO] 127.0.0.1 - - [19/Oct/2025 00:56:14] "POST /upload HTTP/1.1" 201 -
2025-10-19 00:56:49,391 [INFO] 127.0.0.1 - - [19/Oct/2025 00:56:49] "GET /file/1 HTTP/1.1" 200 -
2025-10-19 00:57:04,081 [INFO] 127.0.0.1 - - [19/Oct/2025 00:57:04] "GET /file/2 HTTP/1.1" 200 -
2025-10-19 00:57:15,193 [INFO] 127.0.0.1 - - [19/Oct/2025 00:57:15] "GET /file/3 HTTP/1.1" 200 -
2025-10-19 01:06:50,465 [INFO] File saved: uploads\e91b145c4cf24b55b4945400a314733b_me_making_whispers_at_2am.jpg
2025-10-19 01:06:50,713 [INFO] File updated: ID=1
2025-10-19 01:06:50,725 [INFO] 127.0.0.1 - - [19/Oct/2025 01:06:50] "PUT /file/1 HTTP/1.1" 200 -
2025-10-19 01:07:28,757 [INFO] 127.0.0.1 - - [19/Oct/2025 01:07:28] "DELETE /file/1 HTTP/1.1" 405 -
2025-10-19 01:07:42,164 [INFO] 127.0.0.1 - - [19/Oct/2025 01:07:42] "DELETE /file/1 HTTP/1.1" 405 -
2025-10-19 01:07:52,390 [INFO] 127.0.0.1 - - [19/Oct/2025 01:07:52] "DELETE /file/1 HTTP/1.1" 405 -
2025-10-19 01:09:47,193 [INFO] 127.0.0.1 - - [19/Oct/2025 01:09:47] "DELETE /file/1 HTTP/1.1" 405 -
2025-10-19 01:13:00,890 [INFO] 127.0.0.1 - - [19/Oct/2025 01:13:00] "DELETE /file/1 HTTP/1.1" 405 -
2025-10-19 01:13:27,483 [INFO] 127.0.0.1 - - [19/Oct/2025 01:13:27] "DELETE /file/1 HTTP/1.1" 405 -
2025-10-19 01:14:59,375 [INFO] 127.0.0.1 - - [19/Oct/2025 01:14:59] "DELETE /file/1 HTTP/1.1" 405 -
2025-10-19 01:15:19,771 [INFO] 127.0.0.1 - - [19/Oct/2025 01:15:19] "DELETE /file/1 HTTP/1.1" 405 -
2025-10-19 01:15:44,488 [INFO] 127.0.0.1 - - [19/Oct/2025 01:15:44] "GET /file/1 HTTP/1.1" 200 -
2025-10-19 01:16:35,675 [INFO] * Detected change in 'C:\\Users\\matal\\file-upload\\controllers\\file_controller.py', reloading
2025-10-19 01:16:36,041 [INFO] * Detected change in 'C:\\Users\\matal\\file-upload\\controllers\\file_controller.py', reloading
2025-10-19 01:16:36,140 [INFO] * Detected change in 'C:\\Users\\matal\\file-upload\\controllers\\file_controller.py', reloading
2025-10-19 01:16:36,194 [INFO] * Detected change in 'C:\\Users\\matal\\file-upload\\controllers\\file_controller.py', reloading
2025-10-19 01:16:36,204 [INFO] * Detected change in 'C:\\Users\\matal\\file-upload\\controllers\\file_controller.py', reloading
Binary file added models/__pycache__/uploaded_file.cpython-314.pyc
Binary file not shown.
7 changes: 7 additions & 0 deletions models/uploaded_file.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from app import db # or from extensions import db if you're using extensions.py

# This model represents an uploaded file record in the database
class UploadedFile(db.Model):
id = db.Column(db.Integer, primary_key=True)
filename = db.Column(db.String(255), nullable=False)
file_path = db.Column(db.String(255), nullable=False)
Binary file added requirements.txt
Binary file not shown.
Binary file added services/__pycache__/file_service.cpython-314.pyc
Binary file not shown.
Loading