Update an existing image gallery with new images (and have the images in the correct order)

System Information
  • Strapi Version: 3.3.4
  • Operating System: OS 10.13.6
  • Database: sqlite
  • Node Version: v12.18.3
  • NPM Version: 6.14.6
  • Yarn Version:

Hi Strapi forum, i was wondering if you could help me with this:

When a user want to update an image gallery he owns it is presented with the screen shown below…

The images ( already uploaded ) are fetched and displayed in the correct order and its possible to successfully delete and change the order as well as to make the update request using this code:

const gallery = [gadient, palmTree, garbagePiles]

const formData = new FormData();

formData.append(
“data”,
JSON.stringify({
Artist,
designer,
Album,
gallery,
})
);

(…and then the PUT request)

But the problem comes when i want add a new image (‘greta’, in the example) to the gallery array and then make the update request with the existing images + the new image…

Because if I add the following code (see below) I end with “greta” ( the new image) as the last item of the array (index : 4) and besides, on the index that would be the correct one (index : 0 ) I get an empty object

const gallery = [greta, gadient, palmTree, garbagePiles]

formData.append(“files.gallery”, greta);

So please, forum, please help me make possible to update the gallery respecting and having new images in the correct order.

Thanks :slight_smile:

you found a resolution?