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

Created on 22 November 2022, almost 2 years ago
Updated 7 May 2023, over 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.71.5 2024