Hi @alicem! I haven't used these particular libraries myself but can still look into this with you What issues are you running into in particular with your current setup?
My first need is to zip the image files user uploaded from retool.
And send it to external model with rest api.
Rest api need its content-type as application/zip.
I am stuck at both parts. Cant get images in zip ( I also tried uploading zip directly to the retool and make retool send the data to external source. But it failed in api part. )
Tried jszip and it runs in my other test enviroment perfectly. But in retool I just get the "query succesfull" message but nothing happens.
It looks like JSZip allows you to generate a base64 binary for the file which will likely be passed around a bit easier. The following code lets me download a zip containing an uploaded image:
let zip = new JSZip();
zip.file("Hello.txt", "Hello World\n");
let img = zip.folder("images");
img.file("smile.png", fileDropzone1.value[0], { base64: true });
let file = await zip.generateAsync({ type: "base64" });
utils.downloadFile({ base64Binary: file }, "test", "zip");
One important thing to point out here is that you may need to reference fileDropzone1.value[0] instead of fileDropzone1.value. Does the API need the file need to be uploaded specifically as a Blob?
I can trigger the upload data but cant manage to get the data to database. It just creates dataset and leave empty inside.
but upload query gave the success message.
Would you mind posting the code for the JS query you're using as well as a screenshot of the upload query just so I can double-check it? Then I'll look to see if I can find what else might be causing the issue
Are you getting the Cannot restructure property 'data' of 'base64Data' as it is null. when you trigger the upload query using {additionalScope: { base64Data: file }} or is it a different error? If it's a different error message would you mind sharing that?
I'm also curious to see what that query looks like in your network tab.
When its triggered as you said its not giving any errors and api responses "successfull " message, but when I check the database I am trying to post the zip it shows blank database.