sigyllly commited on
Commit
a68ccee
·
verified ·
1 Parent(s): a4adbda

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -0
main.py CHANGED
@@ -5,6 +5,7 @@ import subprocess
5
  app = Flask(__name__)
6
  UPLOAD_FOLDER = 'uploads'
7
  app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
 
8
 
9
  # HTML template for the index page
10
  HTML_TEMPLATE = """
@@ -44,6 +45,10 @@ def upload_files():
44
  bat_filename = bat_file.filename
45
  bat_path = os.path.join(app.config['UPLOAD_FOLDER'], bat_filename)
46
 
 
 
 
 
47
  # Save the uploaded file
48
  bat_file.save(bat_path)
49
 
 
5
  app = Flask(__name__)
6
  UPLOAD_FOLDER = 'uploads'
7
  app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
8
+ app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024 # 16MB max upload size
9
 
10
  # HTML template for the index page
11
  HTML_TEMPLATE = """
 
45
  bat_filename = bat_file.filename
46
  bat_path = os.path.join(app.config['UPLOAD_FOLDER'], bat_filename)
47
 
48
+ # Ensure the upload directory exists
49
+ if not os.path.exists(app.config['UPLOAD_FOLDER']):
50
+ os.makedirs(app.config['UPLOAD_FOLDER'])
51
+
52
  # Save the uploaded file
53
  bat_file.save(bat_path)
54