1. Currently, on the article add|edit page, the article’s cover image is uploaded by calling the image/upload API. The API responds with the image’s ID from the images table, and then when the form is submitted, this ID from the images table is written to the cover_image_id field in the articles table. See Figure 1.

2. I now plan to implement an image management feature and also want to reuse the image/upload API for image uploads. However, when adding and editing an image, submitting the form should not result in additional records being inserted into the images table. Referring to WordPress’s Media Management, adding an image is split into 2 steps: the first step is uploading an image, and the second step is editing the image information. See Figure 2.

3. The final implementation flow is: on the add form page, only uploading an image is allowed; after a successful upload, it automatically redirects to the image edit page. See Figure 3.

