Upload multiple file resources seem to be bugged at the moment

Options
Sam
Sam Member

Lots of our backend production API are affecting by this, basically file resource[] array type receive only 1 input although we're change it to list type and upload multiple file, xano still only receive one.

A mock up API to demonstrate this:

Input multi file but only 1 file are stored:

Hope you guys can shred some light on us on how this is done,
or please fix it if it is indeed bugged, months before we intensively testd those upload many files and it worked fine.

Tagged:

Best Answer

  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Answer ✓
    Options

    Thanks for the clarification here. The issue is with the structure of the JSON.

    This is invalid:

    {"files": "https://domain.com/myfile1.jpeg", "files": "https://domain.com/myfile2.png"}

    This works:

    {"files": ["https://domain.com/myfile1.jpeg", "https://domain.com/myfile2.png"]}

Answers

  • Chris Coleman
    Chris Coleman Administrator

    ADMIN

    Options

    Hi, Sam. If you're providing multiple attachments, you want to make sure to loop through the array; you won't be able to use a Create Image directly on an array of files.

  • Sam
    Sam Member
    edited April 2023
    Options

    Hi Chris,
    Thank you for your reply, I've seen some of your video on Xano docs, it defninitely helps!

    Back to the thread,
    On the previous mock up API I meant to show there was just 1 jwt while I was sending 3 images. Did you guys encode all of input into 1 JWT?


    Yes in our production API we're using loop for each item,
    Redo the mock up API to show it clearer for you guys:

    On debugger tab:
    it only receive 1 input

    and the result contain only one image:


    Thank you and hope receiving your reply soon!

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    This is a good find! I replicated the same behavior. The problem is not your looping - it is in the input.

    I replicated this using Postman and uploading multiple files into the "a" input when I had it set to a file resource[]. I can set "a" as an array of file resources and upload multiple attachments, but Xano shows just the first in the list. There's nothing really to iterate over. Only the first one shows in the request history input.

    What does work ATM is creating different, singular file upload inputs: a and b. If you know how many potential inputs you could have, this could serve as a workaround. But either you found a bug or I am looking forward to learning the trick to make the file resource array work correctly!