JSFiddle - React, Tailwind, and code Playground

by Edgar Martinez

HTML

<input type='file' id='foto'/>
<button id='btnUp'>
Subir
</button>

JavaScript

$("#btnUp").on('click', function() {
        var formData = new FormData();
        var files = $('#foto')[0].files[0];
        
          formData.append('files',files);


        
        $.ajax({
            url: 'https://pasteboard.co/upload',
            type: 'post',
            data: formData,
            contentType: false,
            processData: false,
            success: function(response) {

            }
        }); 
        
        return false;
    });