Compare commits

...

4 Commits

Author SHA1 Message Date
Aiirondev_dev 51c17d11f2 fix of the json upload format 2026-08-04 20:54:03 +02:00
Aiirondev_dev 91ddc6e864 fix of the json upload format 2026-08-04 20:44:15 +02:00
Aiirondev_dev 88f124c991 fix of the json upload format 2026-08-04 20:42:06 +02:00
Aiirondev_dev 33c65f21b6 fix of the json upload format 2026-08-03 23:55:30 +02:00
2 changed files with 10 additions and 7 deletions
+2 -4
View File
@@ -18,6 +18,7 @@ Features:
"""
from flask import Flask, render_template, request, redirect, url_for, session, flash, send_from_directory, get_flashed_messages, jsonify, Response, make_response, send_file, abort
from flask_wtf import csrf
from werkzeug.utils import secure_filename
from werkzeug.middleware.proxy_fix import ProxyFix
from werkzeug.exceptions import HTTPException
@@ -11863,9 +11864,6 @@ def batch_upload_page():
return render_template('upload_batch.html')
from flask_wtf.csrf import CSRFProtect
csrf = CSRFProtect(app)
@app.route('/upload_csv_batch', methods=['POST'])
@csrf.exempt
@@ -11908,7 +11906,7 @@ def upload_csv_batch():
# 2. CSV Einlesen und Validieren
try:
df = pd.read_csv(csv_file)
df = pd.read_csv(csv_file, sep=';')
except Exception as e:
app.logger.error(f"[Upload {upload_session_id}] Fehler beim Lesen der CSV: {str(e)}")
return jsonify({"success": False, "message": f"Fehler beim Lesen der CSV: {str(e)}"}), 400
+8 -3
View File
@@ -127,6 +127,7 @@
padding-bottom: 0;
}
</style>
<meta name="csrf-token" content="{{ csrf_token() }}">
</head>
<body>
@@ -221,7 +222,7 @@ document.getElementById('batchUploadForm').addEventListener('submit', async func
log(`${uniqueDataRows.length} einzigartige Einträge gefunden. ${duplicateCount} Duplikate entfernt.`);
// Den Index der "Images" Spalte finden
const headers = header.split(',');
const headers = header.split(';');
const imagesColIndex = headers.findIndex(h => h.trim().replace(/['"]/g, '') === 'Images');
// 4. In Batches (Häppchen) aufteilen
@@ -272,11 +273,15 @@ document.getElementById('batchUploadForm').addEventListener('submit', async func
formData.append('images', img);
});
// An Server senden
try {
const csrfToken = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
const response = await fetch('/upload_csv_batch', {
method: 'POST',
body: formData
body: formData,
headers: {
'X-CSRFToken': csrfToken
}
});
const result = await response.json();