Hi there guys!
I started to have quite the weird problem today, maybe somebody can help out?
I am working on a website with an upload button followed by a button setup, like the one from the guideline ( https://support.wix.com/en/article/how-to-use-the-upload-button-with-code ), and it has been working perfect for some time now.
Basically you click the + Artwork Image select the image and then click on Preview Image, then it would take the upload URL and show it on an image.
We have been using this for days on the editor and the published website and it was all fine, but today when we tested it, we started to get an error which seems like CORS on an internal JS every time we press the Preview Image button on the published website ( on the editor preview it works ).
What is most interesting is that on the editor preview it still works like a charm, probably because it's using Wix domain instead of our domain. But like I said, we were testing this for days on the editor and the published website and everything was fine. The code wasn't changed as well.
The Upload File Function code ( The console logs never get printed on the published website ):
$w("#uploadButton1").startUpload()
.then( (uploadedFile) => {
console.log("Upload successful. File is available here:");
fileUrl = getFullImageURL(uploadedFile.url);
console.log(fileUrl);
changeValidationMessage("", "#text29");
$w("#uploadButton1").updateValidityIndication();
artworkInfo.fileUrl = fileUrl;
artworkInfo.file = fileName;
$w("#image35").src = fileUrl;
setUploadedFile(true);
hideLoader();
return fileUrl;
// return continueSubmission(fileUrl);
} )
.catch( (uploadError) => {
console.log(`File upload error: ${uploadError.errorCode}`);
console.log(uploadError.errorDescription);
$w("#uploadButton1").updateValidityIndication();
changeValidationMessage("Please try again!", "#text29");
} );
The Submit Button code:
export function button3_click(event, $w) {
if($w("#uploadButton1").value.length > 0){
uploadFile();
}else{
console.log("File is empty");
}
//Add your code for this event here:
}
Can Anybody help?
Hey Mike,
Yeah, mine works as well. I actually had submitted a ticket as well and it was answered saying that it was something on their end.
It's all good now!
Mine works again now (without me doing anything) so I hope your issue is resolved too
I can’t help but the same thing has happened to my site today. I’m not even using any wix code on my form which had been working fine. Looking in the console it does appear to be an issue with upload file (my console looks the same as yours).