nroeder
September 27, 2022, 2:24pm
1
I'm able to upload a single photo to one drive with the below code. I need to loop through multiple photos and upload them. Photo url is stored in variable {{getPhotos.data.FullUrl}}, name of photo is in {{getPhotos.data.FileName}}
const imgData = await getBinaryImageUrl.trigger({additionalScope: {imageUrl: "https://image.jpg " }});
downloadPhotosOneDrive.trigger();
ScottR
September 27, 2022, 2:41pm
2
2 Likes
nroeder
September 27, 2022, 3:10pm
3
Ok this is defnitley helpful, but since i'm using two APIs one to get the binary image url and one to upload how I modify
async function go() {
for (let i = 0; i < fileInput1.value.length; i++) {
await uploadToS3.trigger({
additionalScope: {
i: i,
},
});
}
}
return go();
nroeder
September 27, 2022, 4:00pm
4
So i got everything to work except getting the imageName to the second api
var myStringArray= getPhotos.data.FullUrl;
var arrayLength = myStringArray.length;
for (var i=0; i <arrayLength; i++) {
await getBinaryImageUrlOneDrive.trigger({
additionalScope: {
imageURL: getPhotos.data.FullUrl[i],
imageName: getPhotos.data.FileName[i]
},
})
}
ScottR
September 27, 2022, 4:32pm
5
I think it should be
getPhotos.data.FileName[i].name
nroeder
September 27, 2022, 5:02pm
6
I'm sure there can be improvement to the code but this works
var myStringArray= getPhotos.data.FullUrl;
var arrayLength = myStringArray.length;
//async function go() {
for (var i=0; i <arrayLength; i++) {
await getBinaryImageUrlOneDrive.trigger({
additionalScope :{
imageURL: getPhotos.data.FullUrl[i]
}
}),
await downloadPhotosOneDrive.trigger({
additionalScope: {
imageName: getPhotos.data.PhotoId[i]+'.jpg',
imageCustomer: tableCustomer.selectedRow.data.Customer
}
});
}
2 Likes