rpldy/react-uploady

ProcessPending set different destination per file

james-hinton opened this issue · 1 comments

Describe the bug
I want to be able to set a different destination for each file. I have to add filename to the destination URL (Azure blob).

Expected behavior
That it sends the file individually, but it processes every file with the same destination URL and ends up overwriting all the files with the same file

Versions
1.1.0

Code
Sorry I really struggle to format this, it just doesnt want to format

      for (let i = 0; i < toDownload.length; i++) {
        const destination = {
          url:
            "https://#.blob.core.windows.net/files/" +
            toDownload[i].path +
            "?sv=2021-06-08&ss=b&srt=sco&sp=rwdlactfx&se=2022-10-21T01:04:32Z&st=2022-09-20T17:04:32Z&spr=https&sig=#",
        };

        processPending({
          destination,
          fileFilter: (file) => file.item === toDownload[i].file.item,
          headers: {
            "x-ms-blob-type": "BlockBlob",
          },
          grouped: false,
        });
      }

hey @james-hinton
processPending isnt meant for individual handling of options.

What you're looking for is: useRequestPreSend
it allows overriding options per file just before its uploaded.

This guide should help get you started with that.

Let me know if you have questions. In the meantime ill convert this into a discussion.