Advertisement
ArthurGoelzer

Untitled

Jul 24th, 2021
1,170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var fileInput =  document.getElementById('image-file');
  2. document.getElementById('image-file').onchange = () => {
  3.     var formData = new FormData();
  4.     formData.append('pictureFile', fileInput.files[0]);
  5.     formData.append('lastId', lastId);
  6.     $.ajax({
  7.         url: './tagimg',
  8.         type: 'POST',
  9.         processData: false, // important
  10.         contentType: false, // important
  11.         dataType : 'json',
  12.         data: formData
  13.     }).done((_user) => {
  14.         window.location = '/tags';
  15.     });
  16. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement