Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 91ddc6e864 | |||
| 88f124c991 |
+2
-1
@@ -11863,6 +11863,7 @@ def batch_upload_page():
|
||||
return render_template('upload_batch.html')
|
||||
|
||||
|
||||
|
||||
@app.route('/upload_csv_batch', methods=['POST'])
|
||||
def upload_csv_batch():
|
||||
"""
|
||||
@@ -11903,7 +11904,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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user