3morrrrr commited on
Commit
3e0537a
·
verified ·
1 Parent(s): 8a76c39

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -22,10 +22,19 @@ def login(username, password):
22
 
23
  def upload_files(creators_file, overnight_file, day_file, prime_file):
24
  try:
25
- creators_file.save(os.path.join(UPLOAD_FOLDER, "creators_file.xlsx"))
26
- overnight_file.save(os.path.join(UPLOAD_FOLDER, "overnight_file.xlsx"))
27
- day_file.save(os.path.join(UPLOAD_FOLDER, "day_file.xlsx"))
28
- prime_file.save(os.path.join(UPLOAD_FOLDER, "prime_file.xlsx"))
 
 
 
 
 
 
 
 
 
29
  return "Files uploaded successfully!"
30
  except Exception as e:
31
  return f"Error uploading files: {e}"
 
22
 
23
  def upload_files(creators_file, overnight_file, day_file, prime_file):
24
  try:
25
+ # Save each file using the 'data' attribute
26
+ with open(os.path.join(UPLOAD_FOLDER, "creators_file.xlsx"), "wb") as f:
27
+ f.write(creators_file.read())
28
+
29
+ with open(os.path.join(UPLOAD_FOLDER, "overnight_file.xlsx"), "wb") as f:
30
+ f.write(overnight_file.read())
31
+
32
+ with open(os.path.join(UPLOAD_FOLDER, "day_file.xlsx"), "wb") as f:
33
+ f.write(day_file.read())
34
+
35
+ with open(os.path.join(UPLOAD_FOLDER, "prime_file.xlsx"), "wb") as f:
36
+ f.write(prime_file.read())
37
+
38
  return "Files uploaded successfully!"
39
  except Exception as e:
40
  return f"Error uploading files: {e}"