Horje
Multiple File Upload using js Code Example
Multiple File Upload using js
const formData = new FormData();
const photos = document.querySelector('input[type="file"][multiple]');

formData.append('title', 'My Vegas Vacation');
for (let i = 0; i < photos.files.length; i++) {
  formData.append(`photos_${i}`, photos.files[i]);
}

fetch('https://example.com/posts', {
  method: 'POST',
  body: formData,
})
.then(response => response.json())
.then(result => {
  console.log('Success:', result);
})
.catch(error => {
  console.error('Error:', error);
});




Javascript

Related
Use compiler option '--downlevelIteration' to allow iterating of iterators. Code Example Use compiler option '--downlevelIteration' to allow iterating of iterators. Code Example
to the power of javascript Code Example to the power of javascript Code Example
react native basic template Code Example react native basic template Code Example
js confirm Code Example js confirm Code Example
script refresh js Code Example script refresh js Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
6