Uploading Image URL to S3 via API without storing binary data to Xano File Storage?? - HELP PLEASE

Options
DanGardner5565
DanGardner5565 Member
edited March 2023 in ? Transforming data

Right now I'm trying to save an image file to S3 via it's public web URL using Xano.

S3 only allows me to upload a binary image file, which is fine. But in order to do so, I have to download the image from the URL, save it to Xano file storage, then upload the binary Xano file to S3 via API, then delete the binary file in Xano so I don't rack up a bunch of Xano storage costs. The only reason I am saving them to Xano storage is because S3 can only accept a binary image file.

Is there a way to convert my image url to binary data and save it in some kind of short term memory or cache (temporarily) while i upload it to S3, then delete it? I'm really trying to avoid downloading to a file resource in Xano because it's so time consuming, and I also have to add an extra step to delete the file resource. It's just adding a lot of extra load on my function.

Best Answers

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

    You do not have to save to Xano file storage. When you do a file upload in Xano, you can retrieve the data from the file resource via the corresponding function under "upload files" That data is what you can then shove into the body of your request to S3. Binary data should work fine with the appropriate content-type header (usually octet/stream for a generic binary payload). Does that help?

  • DanGardner5565
    DanGardner5565 Member
    Answer ✓
    Options

    Thank you!!

Answers

  • endrefyl
    endrefyl Member
    Options

    Hi, @DanGardner5565 ! Just curious, which S3 api do you use? I sat up an api through aws api gateway, but it seems like it has a limit for 10 mb (aws side) and is not rendundant in my case.