Why wouldn’t this work? I just want the upload file piece to work for now so haven’t included the collection save code. Shouldn’t uploadedImage contain the returned array of the .uploadFiles() function?
Did you follow the typical file upload scenario ? There are some sample code snippets in the uploadFiles() API . Did you actually upload any files using the upload button? What do you see in the console?
I have followed the typical upload scenario and have that working elsewhere…what I am doing here is trying to get my head around usning as async function to achieve the same thing, so this isn’t a full example. Using async for file upoloads is less well documented in the API docs.
I would have expected the console.log command to output the file location, given how I wrote the code, but it is showing “undefined” instead. I would have expected the fact that it has to await the outcome of the uploadFiles() function to mean that this isn’t a timing issue with the promise though.
Using await should be the same as getting the result in the .then() function of the Promise. Since you say this isn’t a full example, perhaps the rest of your code is causing the problem?
You say this works elsewhere using .then(). If you change it to await does it work, or does it also fail? Perhaps you are trying to upload invalid files?
There is no other code…it’s a test page with nothing else. Oddly, it’s working fine now…don’t know what I was doing wrong before but it may have been the wrong file type as you suggest.
Sorry for wasting your time, but thanks for the help.