How to include file attachment in ajax submission via the rest_api?

Question

When submitting a form via jQuery and using admin-ajax, including a file attachment was easy:

var data = new FormData($(this)[0]);

This submits all the form fields, except the file attachment.

var data = $this.serializeArray();

How do you include a file attachment with the rest_api approach?

0
shanebp 1 year 2020-07-18T17:10:43-05:00 0 Answers 51 views 0

Leave an answer

Browse
Browse