Ready to get started?Download WordPress


Add attachment to create_post (2 posts)

  1. andersson_ma
    Posted 1 year ago #

    I'm currently creating post by using an jquery ajax call which looks something like this
    and it works just fine.

    However I would like to submit an attachment to the post as well and I'm unsure just how to do that. I've added an input[type=file] with the name of attachment but I can't figure out how to send it with my request.

    Is it possible to include a file with AJAX or do I have to migrate back to a native Form solution. If so, how would I go about doing it?


  2. monkeypunch3
    Posted 1 year ago #

    This page and the page linked on it have information that I've used to get it to work. https://developer.mozilla.org/en-US/docs/Web/Guide/Using_FormData_Objects. I've since changed the code so no code example.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic