How to post file via POST API : /entity/file

Created on 22 November 2022, over 1 year ago
Updated 7 May 2023, about 1 year ago
💬 Support request
Status

Active

Version

1.21

Component

Documentation

Created by

🇬🇵Guadeloupe Monster971

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India gandhiv

    Facing the same issue.

  • 🇷🇺Russia kvantstudio

    Use right endpoint like this and set permissions on media type settings:

    axios.post('/file/upload/media/YOUR_MIDIA_TYPE_ID/field_media_video_file?_format=json', e.target.result, {
      headers: {
        'Content-Type': 'application/octet-stream',
        'Content-Disposition': `file; filename="${filename}"`,
        'X-CSRF-Token': response.data,
      }
    })
    
Production build 0.69.0 2024