DmitrMakeev commited on
Commit
9da67d2
·
verified ·
1 Parent(s): df73573

Update up_fa.html

Browse files
Files changed (1) hide show
  1. up_fa.html +15 -0
up_fa.html CHANGED
@@ -92,6 +92,21 @@ document.addEventListener('DOMContentLoaded', function() {
92
  if (uploadForm) {
93
  uploadForm.addEventListener('submit', function(event) {
94
  event.preventDefault();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  var formData = new FormData(this);
96
  var request = new XMLHttpRequest();
97
  request.open('POST', '/up_page');
 
92
  if (uploadForm) {
93
  uploadForm.addEventListener('submit', function(event) {
94
  event.preventDefault();
95
+
96
+ // Проверка наличия файла
97
+ const fileInput = document.querySelector('input[type="file"]');
98
+ if (!fileInput || !fileInput.files.length) {
99
+ console.error("No file selected");
100
+ Toastify({
101
+ text: "Please select a file to upload",
102
+ duration: 3000,
103
+ gravity: "top",
104
+ position: "center",
105
+ backgroundColor: "#FF5733",
106
+ }).showToast();
107
+ return;
108
+ }
109
+
110
  var formData = new FormData(this);
111
  var request = new XMLHttpRequest();
112
  request.open('POST', '/up_page');