WordPress.org

Ready to get started?Download WordPress

Forums

JSON API
Add attachment to create_post (2 posts)

  1. andersson_ma
    Member
    Posted 10 months ago #

    I'm currently creating post by using an jquery ajax call which looks something like this
    localhost/?json=create_post&nonce=xxxx&title=x&content=x
    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?

    http://wordpress.org/plugins/json-api/

  2. monkeypunch3
    Member
    Posted 7 months 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.

Reply

You must log in to post.

About this Plugin

About this Topic