🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

strapi-plugin-media-upload

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strapi-plugin-media-upload

A plugin that help you upload file to a specific file system using api

1.1.2
latest
Version published
Weekly downloads
29
-34.09%
Maintainers
2
Weekly downloads
 
Created

Strapi Plugin Media Upload

A plugin that help you upload media to a specific folder using api in strapi.

Features

  • Upload files to a specific folder structure.
  • Manage folders and files through API.
  • Easy integration with Strapi projects.

Installation

npm i strapi-plugin-media-upload

Configuration

After installation, the plugin will be automatically enabled.

Usage

Upload media files to a specific folder using the provided API endpoints.

Folders Manager

1.Query Folders

  • GET /<strapiprefix>/media/folders
  • Query Params:
    • parentId (optional): ID of the parent folder, return root folders if not fill.
    • sort[] (optional): e.g.sort[0]=createdAt:asc&sort[1]=updatedAt:desc

2.Create Folder

  • POST /<strapiprefix>/media/folder
  • Request Body:
    {
        "name": "New Folder", // Required, folder name
        "parentId": 1         // Optional, ID of the parent folder
    }
    

3.Update Folder

  • PUT /<strapiprefix>/media/folder
  • Request Body:
    {
        "id": 1,              // Required, ID of the folder to update,
        "name": "New Folder", // Required, folder name
        "parentId": 1         // Optional, new parent folder ID
    }
    

4.Delete Folder

  • DELETE /<strapiprefix>/media/folder
  • Query Params:
    • id: the id of folder should be deleted (attention: folders and files under this folder would be deleted by the way)

5.Folder Structure

  • GET /<strapiprefix>/media/folder-structure

6.Query Folder By ID

  • GET /<strapiprefix>/media/folder
  • Query Params:
    • id (optional): ID of the folder

7.Delete Folders and Files

  • POST /<strapiprefix>/media/bulk-delete
  • Request Body:
    {
      "fileIds": [27],    // Required, ID of the files to delete
      "folderIds": [20]   // Required, ID of the folders to delete
    }
    

8.Move Folders and Files

  • POST /<strapiprefix>/media/bulk-move
  • Request Body:
    {
      "targetFolderId": 21, // Required, ID of the target folder, if not provided, the items would be move to the root folder.
      "fileIds": [27],      // Required, ID of the files to delete
      "folderIds": [20]     // Required, ID of the folders to delete
    }
    

Media Uploader

1.Upload Media

  • POST /<strapiprefix>/media/upload
  • Request Body:
    • file (multipart/form-data): The file to upload.
    • folderId (optional): ID of the folder where the file should be uploaded.

2.Update Media

  • PUT /<strapiprefix>/media/update
  • Request Body:
    {
        "id": 1,    // Required, ID of the file to move,
        "name": "New Name", // Optional, new file name
        "alternativeText": "New Alternative Text", // Optional, new alternative text,
        "caption": "New Caption", // Optional, new caption,
        "folderId": 1,  // Optional, folder id
    }
    

Compatibility

This plugin is compatible with Strapi 5.0.0 and above.

Issues

If you encounter any issues, please report them here.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Author

Eli Liu
Email: Mr.liu93@outlook.com
GitHub: Littlexiaoxiaojian

FAQs

Package last updated on 26 Mar 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts