I am uploading images when save into db and then display on gallery

I am uploading images when save into db and then display on gallery . My problem is that when i get images uploading time only some of the images loaded but other images not loaded what is issue in my code ?

const uploadToServer = async (files) =>{
        const formData = new FormData();
        for (const key of Object.keys(files)) {
          formData.append("files", files[key]);
        }
        // formData.append("files", files);
        formData.append("galleryId", galleryId);
        const requestOptions = {
            method: 'POST',
            headers: { "Contetnt-Type": "multipart/form-data" },
            body: formData
        };
        const response =  await fetch("/api/uploadAssets?shop="+shop_domain, requestOptions)
        const imgList = await response.json()
        console.log("image List ",imgList);
        if(imgList){
          setPage(<GalleryGrid imgList={imgList} galleryId={galleryId} setPage={setPage} setPageTitle={setPageTitle} />);
        }
        
        setMessage(true);
        setTimeout(() => {
            setMessage(false);
        }, 1000);
        setFiles([]);
        setLoading(false);
        
    }

when i get above response not getting all as per gallery id what is problem with my code

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.