UPLOAD BUTTON - ub1
button - button16
image - image24
i just want to remove ‘button’ or hide it .
when some1 load a image it preview it automatically with the help of code
is it possible?
if yes , show me ur code
thanks in advance !
plz read the question carefully
i want to upload files without clicking a “button”
i want something that automatically starts ‘startupload()’ function while user chooses a file.
Shan
April 4, 2020, 4:49am
4
Yes, you can use an .onChange() event for the upload button. Something like this:
$w.onReady( function() {
$w("#uploadButton").onChange( (event) => {
$w("#uploadButton").startUpload()
.then( (uploadedFile) => {
let url = uploadedFile.url;
$w("#image1").src = url;
$w("#uploadButton").hide();
//do something else too
});
});
});
This does work, you just can’t always copy and paste code from here and expect it to work for you every time, sometimes you have to change it to suit your own site and setup.
It all works for me here, with the Wix tutorial using onClick here.
https://givemeawhisky.wixsite.com/onchangetest
Along with the onChange test here which uses Shan’s code above as a starting point to work off of.
https://givemeawhisky.wixsite.com/onchangetest/test
thanks @shan and @givemeawhisky , it worked …but i have to do change sm code…any1 can see it here
@dimensionwave
$w.onReady(function () {
});
export function uploadButton1_change(event) {
$w("#uploadButton1").startUpload()
.then( (uploadedFile) => {
let url = uploadedFile.url;
$w("#image1").src = url;
$w("#uploadButton1").hide();
//do something else too
});
}