added controller for QR photo upload and inserted route for it. added functional for multiple photo upload.

This commit is contained in:
2025-08-11 16:30:24 +04:00
parent 8978980901
commit 7ad20993d9
8 changed files with 174 additions and 53 deletions
+10 -5
View File
@@ -14,13 +14,18 @@ if (!$iddatadb) {
}
try {
$stmt = $pdo->prepare("SELECT file_path FROM datadb_photos WHERE iddatadb = :iddatadb LIMIT 1");
// Adjust the query to select all photo paths for the given iddatadb
$stmt = $pdo->prepare("SELECT file_path FROM datadb_photos WHERE iddatadb = :iddatadb");
$stmt->execute([':iddatadb' => $iddatadb]);
$photo = $stmt->fetch(PDO::FETCH_ASSOC);
$photos = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($photo && $photo['file_path']) {
$fullPath = '../photostrf/' . $photo['file_path']; // Assumi che le foto siano nella cartella photostrf
echo json_encode(['success' => true, 'file_path' => $fullPath]);
if ($photos && count($photos) > 0) {
// Prepare an array of full file paths
$photoPaths = array_map(function($photo) {
return '../photostrf/' . $photo['file_path']; // Assuming the photos are stored in the "photostrf" folder
}, $photos);
echo json_encode(['success' => true, 'photos' => $photoPaths]); // Return an array of photo paths
} else {
echo json_encode(['success' => false, 'message' => 'Nessuna foto trovata']);
}