Uploading files with AJAX

Accepting file uploads with AJAX is not supported by some browsers like Internet Explorer, but you can still do it with Getform. Paste the following AJAX code before your body tag:

See the Pen HTML Ajax Form Example & File Upload by Getform (@getform) on CodePen.

Note: You should add enctype="multipart/formdata" as in the regular case.

After that you can add class="ajaxForm" to your HTML form to finish the setup like this:

<form class="ajaxForm" action="https://getform.io/f/{your-endpoint}" method="POST" enctype="multipart/form-data">

    <input type="text" name="name" id=”name”>
    <input type="email" name="email" id=”email”>
    <input type="file" name="file">
    <button type="submit">Send</button>

</form>

That's it! You can also accept files for your form submissions using AJAX.