Today I was using AJAX to send FormData with JavaScript but the FormData was empty on the client and the server. Why? Because my input element did not have a name attribute. When submitting your form via FormData in AJAX you must include a name attribute.

<form id=’upload-cover-art’ enctype=”multipart/form-data” >
<input type=”file” id=’input-cover-art’ accept=”image/*” name=’cover-art’ />
<input type='submit' value='submit' />
</form>
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.