Hello, I have an upload image button that works perfectly on the Web but on the mobile, it let’s me select the picture and then it doesn’t do anything. Doesn’t upload it.
I do have an uploadButton change event which i don’t think has anything to do with it but in any case this is the code
export function imageButton_change(event, $w) {
let uploadedFileUrl =“”;
if ( $w(“#imageButton”).value.length > 0) {
$w(‘#preloaderImage’).show();
$w(‘#saveButton’).disable();
$w(“#imageButton”).startUpload()
.then( (uploadedFile) => {
$w(“#pictureUploaded”).src = uploadedFile.url;
$w(‘#preloaderImage’).hide();
$w(‘#saveButton’).enable();
console.log(“picture uploaded properly”);
} )
. catch ( (uploadError) => {
$w(‘#preloaderImage’).hide();
$w(‘#saveButton’).enable();
console.log(uploadError);
} ); // end catch
} // end if
}
Do you get any errors in the catch phrase on mobile?
Not that I can see. It doesn’t do anything after I choose the picture.
Anyone?
This is a Wix Bug but Wix support say they cannot do anything about it since it’s Wix Code.
What should I do?
Is the problem in Preview or Live - or both? I tried in Preview, and Live on my iPhone and it works fine.
Here’s my code (for what it’s worth):
export function button1_click(event, $w) {
if ($w("#uploadButton1").value.length > 0) {
$w("#text1").text = `Uploading ${$w("#uploadButton1").value[0].name}`;
$w("#uploadButton1").startUpload()
.then((uploadedFile) => {
$w("#text1").text = "Upload successful";
$w("#image1").src = uploadedFile.url;
})
.catch((uploadError) => {
$w("#text1").text = "File upload error";
console.log(`Error: ${uploadError.errorCode}`);
console.log(uploadError.errorDescription);
});
} else {
$w("#text1").text = "Please choose a file to upload.";
}
}