File Component Events
by brendanbond
HTML
<link
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet"
integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB"
crossorigin="anonymous"
/>
<link rel="stylesheet" href="https://cdn.form.io/js/formio.full.min.css" />
<div class="container">
<div id="formio"></div>
</div>
<script src="https://cdn.form.io/js/formio.full.js"></script>
JavaScript
// This form has a simple file component set to POST to a [mockbin](mockbin.io) that always responds with a 200 status code + some JSON. It might be expired by the time you get to this, so you can always create your own to test it out.
Formio.createForm(
document.getElementById('formio'),
'https://bb-happy-time.form.io/filecomp',
).then((form) => {
form.on('fileUploadError', (...args) => {
console.log('error:', args);
});
});