Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -94,8 +94,12 @@ def upload_file():
|
|
| 94 |
else:
|
| 95 |
print("Folder not got it......................")
|
| 96 |
file_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)
|
| 97 |
-
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
# Handle non-JSON files
|
| 101 |
if not filename.lower().endswith('.json'):
|
|
|
|
| 94 |
else:
|
| 95 |
print("Folder not got it......................")
|
| 96 |
file_path = os.path.join(app.config['UPLOAD_FOLDER'], filename)
|
| 97 |
+
try:
|
| 98 |
+
file.save(file_path)
|
| 99 |
+
flash('File uploaded successfully', 'success')
|
| 100 |
+
except Exception as e:
|
| 101 |
+
flash(f"Error saving file: {str(e)}", 'error')
|
| 102 |
+
return render_template('upload.html')
|
| 103 |
|
| 104 |
# Handle non-JSON files
|
| 105 |
if not filename.lower().endswith('.json'):
|