在创建条目时上传文件不再受支持
🌐 Upload a file at entry creation is no longer supported
在 Strapi 5 中,创建条目时无法上传文件,因此应分两步完成。
🌐 In Strapi 5, it is not possible to upload a file while creating an entry, so this should be done in 2 steps.
此页面是重大更改数据库的一部分,提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。
🌐 This page is part of the breaking changes database and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.
重大变更描述
🌐 Breaking change description
在 Strapi v4 中
在创建条目时可以上传文件,如 documented for Strapi v4所示。
在 Strapi 5 中
你必须先上传文件,然后使用创建的文件 ID 创建条目。
🌐 You must upload the file first, and then create the entry with the created file id.
迁移
🌐 Migration
本节重新组合了有关引入的重大更改的有用说明和程序。
🌐 This section regroups useful notes and procedures about the introduced breaking change.
迁移程序
🌐 Migration procedure
用户必须更新他们的自定义代码,首先向 /api/upload/的 Upload API 发送 POST 调用,然后使用创建的文件 ID 向 /api的 REST API 发送 POST 调用 创建一个条目。
🌐 Users must update their custom code, first sending a POST call to the Upload API at /api/upload/, then creating an entry with a POST call to the REST API at /api with the created file id.