Recent Posts

Caution: Greetings to all visitors. The site is working in short. Links Please skip the link to view any topic and thank you for visiting
header ads

Simple Fetch API Wrapper with Concise File Upload

https://ift.tt/2WwNsVy

There's many advantages this wrapper has over similar ones, but I will highlight file uploading.

async uploadFiles() {
  const photos = document.querySelector('#photos').files;
  const videos = document.querySelector('#videos').files;

  await ff.put('https://example.com/upload', {
    data: { name: 'Jeremy' },
    files: { photos, videos },
  });
}
Code (markup):
Doing this in vanilla fetch would require creating a new FormData object, traverse...

Simple Fetch API Wrapper with Concise File Upload

from JavaScript https://ift.tt/3cw9EDD
via IFTTT

Post a Comment

0 Comments