I’m using the file uploader button component to save an image to files storage. Works great… and I’m using ‘background-image’ style property for the button to show users what the image in storage is.
I’m having a problem with updating that background after user successfully uploads an image… tried adding a delay, all sorts of things, to no avail. Here is the part of the code that’s relevant:
End goal is the user sees the avatar they created, but they might “change their mind” and upload a different pic right then and there. Maybe that’s an edge case, perhaps it would be enough to show them the result and not reset the uploader button, but instead mount an image that gets the url from the database… just curious why the style change doesn’t happen when programmed into the “upload successful” logic
First - In the upload success event handler set imageURL to Uploaded Files.
Second - Add the following blocks to the upload button Styles Logic handler. The Styles Logic handler will refresh the button style when the status of the button changes… like when upload success has completed.
Hi Glenn, that works a little better (works once but not if the user uploads images more than once). Actually I figured out that my problem was “browser cache”!
I had configured the uploader to generate a file name (unique to each user but always the same) and to overwrite existing file with that name. Just to be organized and to not accumulate garbage files… but the browser didn’t know the image had changed (because it always has the same URL/file name). If I change file name on each upload, things work fine.