-
Add the full file names to your csv file (make sure each file has a unique name).
-
Import the csv to your collection.
-
Create a webpage and add an upload button.
-
Use code to upload multi-files.
-
Once the files are loaded, query the collection for their original name.
-
Update the URL.
Something like:
import wixData from 'wix-data';
let fileData = [];
$w.onReady(() => {
$w('#uploadAllBtn').onClick( () => {
if($w('#uploadButton').value.length < 1) { return;}
$w('#uploadButton').uploadFiles()
.then(files => {
fileData = files;
const fNames = files.map(f => f.originalFileName);
return wixData.query('CollectionName').hasSome('fileName', fNames).limit(1000).find()
})
.then(r => {
const {items} = r;
if(!items.length){return Promise.reject('query failed');}
items.forEach(e => {
const file = fileData.find(f => f.originalFileName === e.fileName);
if(file){
e.imageUrl = file.fileUrl;
}
})
return wixData.bulkUpdate('CollectionName', items);
})
.then(() => console.log('DONE'))
.catch(err => console.error(err));
});
})