Instead of using the standard upload button from User Input, can I set up a custom logo/shape to upload a user image?
The main issue, is that there is no code (that I know of) which prompts the file selection of an upload. You literally have to click the upload button in order to upload a file. However, I don’t like the aesthetic of that button, so I want to make my own button. I think either of these two solutions would work, if anyone knows how to do it?
Is there code to prompt the file selection of the standard upload button without clicking it?
Is there code which can “click” the upload button through on OnClick event of another button?
Hi David,
Don‘t know whether this would work… but I would try it:
add both the normal Upload-Button and your custom button to your side by clicking the custom button the onClick() event is fired… in this event set the focus to the standard upload button with the focus function… this should be interpreted as click on the upload button and should open the file selector?
„Description
The focus() function places focus on the element and fires a focus event.
The focus event handlers set on this element by the onFocus( ) function or in the Editor will called.
Receiving focus through a call to this function is equivalent to a user clicking on or tabbing to the element manually.“
Right now, when I click the custom button, it focuses the Up-load button, but doesn’t actually click it. Essentially, it’s like I hovered over or tabbed to it. If I hit ENTER after I click my custom button, it opens the file upload. So, we’re close?
Super basic code, but if it helps.
export function shape2_click(event) {
$w("#uploadButton1").focus();
}
Hi David,
Could you share a bit about what kind of look you were trying to achieve. We’d love that input.
In the meantime - you may be able to work around it by placing the upload button over a regular button and playing with the opacity and colors in the design panel to get it to seem invisible.
Ahh yes, I think that work-around will suffice for my purposes. Below is a screenshot for what I was thinking. This is just from LinkedIn. Essentially, if I want to edit my profile photo, aesthetically it looks much nicer to have the circular edit button as opposed to the traditional upload button.