Media Upload
A plugin that help you upload file to a specific file system using rest api
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:
2.Create Folder
POST /<strapiprefix>/media/folder
- Request Body:
1{ 2 "name": "New Folder", // Required, folder name 3 "parentId": 1 // Optional, ID of the parent folder 4}
3.Update Folder
PUT /<strapiprefix>/media/folder
- Request Body:
1{ 2 "id": 1, // Required, ID of the folder to update, 3 "name": "New Folder", // Required, folder name 4 "parentId": 1 // Optional, new parent folder ID 5}
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:
1{ 2 "fileIds": [27], // Required, ID of the files to delete 3 "folderIds": [20] // Required, ID of the folders to delete 4}
8.Move Folders and Files
POST /<strapiprefix>/media/bulk-move
- Request Body:
1{ 2 "targetFolderId": 21, // Required, ID of the target folder, if not provided, the items would be move to the root folder. 3 "fileIds": [27], // Required, ID of the files to delete 4 "folderIds": [20] // Required, ID of the folders to delete 5}
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:
1{ 2 "id": 1, // Required, ID of the file to move, 3 "name": "New Name", // Optional, new file name 4 "alternativeText": "New Alternative Text", // Optional, new alternative text, 5 "caption": "New Caption", // Optional, new caption, 6 "folderId": 1, // Optional, folder id 7}
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
Install now
npm install strapi-plugin-media-upload
Create your own plugin
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.