Could someone help me why am i getting this error?
You don’t have back-ticks around the string.
so where should they be thankyou for the help ![]()
@frog866 It’s hard working from a screenshot - code should be posted in a code block. In any case, something like this:
$w('#text67').text = `Uploading ... `;
For more info, read the article on template literals.
import wixData from 'wix-data';//to work with the collection you need to import this field
export function button1_click(event) {
for (var x = 0; x <= 3; x++) {//for 4 upload buttons the maximum index is 3
if ($w("#uploadButton" + x).value.length > 0) {
$w("#text67").text = Uploading ${$w("#uploadButton"+x).value[0].name};
$w("#uploadButton" + x).startUpload()
.then((uploadedFile) => {
let toInsert = {//myImage is the field key for your images column in the collection
"gallery": uploadedFile.url
};
wixData.insert("locations", toInsert)//myCollection is name of the collection to where the images are added
.then((results) => {
$w("#text67").text = "Upload successful"; //see item below
})
.catch((err) => {
let errorMsg = err;
});
})
.catch((uploadError) => {
$w("#text67").text = "File upload error";
console.log(Error: ${uploadError.errorCode});
console.log(uploadError.errorDescription);
});
} else {
$w("#text67").text = "Please choose a pic to upload.";
}
}
}
You need to enclose your string in back-ticks - this char `
Like this:
$w("#text67").text = `Uploading ${$w("#uploadButton"+x).value[0].name}`;
For more info, read the article on template literals.
thankyou, I am now getting an error on line 22 saying
‘parsing error: unexpected token :’
import wixData from 'wix-data';//to work with the collection you need to import this field
export function button1_click(event) {
for (var x = 0; x <= 3; x++) {//for 4 upload buttons the maximum index is 3
if ($w("#uploadButton" + x).value.length > 0) {
$w("#text67").text = 'Uploading ${$w("#uploadButton"+x).value[0].name}';
$w("#uploadButton" + x).startUpload()
.then((uploadedFile) => {
let toInsert = {//myImage is the field key for your images column in the collection
"gallery": uploadedFile.url
};
wixData.insert("locations", toInsert)//myCollection is name of the collection to where the images are added
.then((results) => {
$w("#text67").text = "Upload successful"; //see item below
})
.catch((err) => {
let errorMsg = err;
});
})
.catch((uploadError) => {
$w("#text67").text = "File upload error";
console.log(Error: ${uploadError.errorCode});
console.log(uploadError.errorDescription);
});
} else {
$w("#text67").text = "Please choose a pic to upload.";
}
}
}
That is because you used are regular tick mark ’ instead of a bac ktick `.
You can find the back tick on the key at the upper left of the keyboard.
https://www.computerhope.com/jargon/b/backquot.htm
Please, read the article on template literals .

