Ashrafb commited on
Commit
0f5d203
·
verified ·
1 Parent(s): 9d71930

Update AB/index.html

Browse files
Files changed (1) hide show
  1. AB/index.html +4 -4
AB/index.html CHANGED
@@ -222,7 +222,7 @@ h1 {
222
  <h1>Aiconvert.online </h1>
223
  <form id="uploadForm" action="/upload/" method="post" enctype="multipart/form-data">
224
  <label for="sourceFile" class="uploadLabel">Choose image </label>
225
- <input type="file" id="sourceFile" name="image_file" accept="image/*" required onchange="previewImage(event, 'sourceImage')"><br>
226
  <div id="sourceImageContainer">
227
  <img id="sourceImage">
228
  </div><br>
@@ -269,13 +269,13 @@ h1 {
269
 
270
 
271
  async function uploadFile() {
272
- const sourceFileInput = document.getElementById('sourceFile');
273
  const resultContainer = document.getElementById('resultContainer');
274
 
275
 
276
 
277
  // Check if both source and destination file inputs are empty
278
- if (!sourceFileInput.files[0] ) {
279
  // Update the result container with the error message
280
  resultContainer.innerHTML = "<p>Please upload an image.</p>";
281
  return;
@@ -286,7 +286,7 @@ h1 {
286
 
287
  const formData = new FormData();
288
  const fileInput = document.querySelector('input[type="file"]');
289
- formData.append('image_file', fileInput.files[0]);
290
 
291
  try {
292
  // Display loading spinner
 
222
  <h1>Aiconvert.online </h1>
223
  <form id="uploadForm" action="/upload/" method="post" enctype="multipart/form-data">
224
  <label for="sourceFile" class="uploadLabel">Choose image </label>
225
+ <input type="file" id="image_file" name="image_file" accept="image/*" required onchange="previewImage(event, 'sourceImage')"><br>
226
  <div id="sourceImageContainer">
227
  <img id="sourceImage">
228
  </div><br>
 
269
 
270
 
271
  async function uploadFile() {
272
+ const image_fileInput = document.getElementById('image_file');
273
  const resultContainer = document.getElementById('resultContainer');
274
 
275
 
276
 
277
  // Check if both source and destination file inputs are empty
278
+ if (!image_file.files[0] ) {
279
  // Update the result container with the error message
280
  resultContainer.innerHTML = "<p>Please upload an image.</p>";
281
  return;
 
286
 
287
  const formData = new FormData();
288
  const fileInput = document.querySelector('input[type="file"]');
289
+ formData.append('image_file', image_file.files[0]);
290
 
291
  try {
292
  // Display loading spinner