Home >Backend Development >PHP Tutorial >javascript - About multiple image uploads
For example, if you publish a product and have multiple corresponding pictures at the same time, there are two methods, which one is better, or how everyone does it:
Upload the image first, get the image address, and then upload the image address when publishing the product
First generate the product and return the corresponding id of the product, then upload the product id while uploading the image for binding
For example, if you publish a product and have multiple corresponding pictures at the same time, there are two methods, which one is better, or how everyone does it:
Upload the image first, get the image address, and then upload the image address when publishing the product
First generate the product and return the corresponding id of the product, then upload the product id while uploading the image for binding
Wouldn’t it be better to package and upload the images first, and then select the gallery when publishing the product? This is generally handled in the background. When publishing products, uploading images is cumbersome and error-prone, and many form items need to be backfilled
Personal opinion:
The second is better. The picture is attached to the product, not the other way around
The second option is to select directly from the photo library