I try to upload multiple files to my DO s3 bucket. When I upload them using the S3 Multi Upload it works but it also trigger the error in the following image. And when I try to emit a socket on success with a parameter that depends on the response of the upload server action (i.e. sign and url) it always comes undefined on the server side(The socket server action) even though I see them in the browser's network response.
Hello, @patrick @Teodor
Can you please look into this?
As to the error, it seems that 'this' is not preserved as it refers to the window object as you can see in the debug mode in the image above. So I tried adding .bind(this) to the function and the error disappears but I am not sure of this. Also I saw patrick in this post talking about adding a new property for the component that holds all the successful uploaded file info. So any updates on this?
Thanks
Thx for the debugging. I've change multiple function to arrow functions now which should solve the this
issue. A bind would indeed do the same but I find arrow functions a bit better since they don't generate a separate function scope.
Here the update: dmxS3Upload.zip (12.4 KB)
A post was split to a new topic: How to call s3 upload from JavaScript function?