Skip to main content

Uploading Files Using an API

Overview

When uploading files using an API for content, forms, members, etc., you can use the Files::upload endpoint to upload the file to Kuroco's temporary storage and then POST the returned file_id to update the content in each endpoint.

To confirm the functionality using SwaggerUI, follow the steps below.

Steps

  1. Upload the file to the Files::upload endpoint.
    Open the Files::upload endpoint and click the [Select File] button to choose the file to upload.

    Image from Gyazo

    tip

    Specify 'Content-Type': 'multipart/form-data' in the request header when sending the file.

  2. Confirm the file_id from the response.
    Once the upload to the temporary storage is successful, the response containing the file_id will be displayed.

    Image from Gyazo

  3. POST the file_id to the endpoint for updating the content.
    Send a request to the endpoint that handles the content you want to update or add, specifying the file_id.

    Image from Gyazo

    info

    In the example capture, a request is sent to Member::update. In the HTML of the HTML item and Wysiwyg item of the content that path will also be updated if there are img/a tags like <img src="https://[KurocoFiles host]/files/temp/**.jpg">

  4. Confirm that the request was successful.
    Check the response and the content.

    Image from Gyazo

Please refer to the related documentation for specific code examples in the frontend.


Support

If you have any other questions, please contact us or check out Our Slack Community.