debugging failed file upload on prod but not in dev

This commit is contained in:
Rostislav Raykov
2024-10-08 23:42:16 +03:00
parent 08b30677b6
commit f9b88a268e
2 changed files with 4 additions and 0 deletions

View File

@@ -33,6 +33,8 @@ public class FileService {
}
public FileEntity saveFile(MultipartFile file, FileUploadRequest fileUploadRequest) {
logger.info("File received: {}", file.getOriginalFilename());
String uuid = UUID.randomUUID().toString();
Path path = Path.of(fileSavePath, uuid);
try {
@@ -40,6 +42,7 @@ public class FileService {
Files.write(path, file.getBytes());
logger.info("File saved: {}", path);
} catch (Exception e) {
logger.error("Error saving file: {}", e.getMessage());
return null;
}

View File

@@ -30,6 +30,7 @@ document.getElementById("uploadForm").addEventListener("submit", function (event
}
} else {
alert("Upload failed. Please try again.");
console.log(xhr.responseText);
document.getElementById("uploadIndicator").style.display = "none";
}
};