I have developed a page which uses Code to edit entries in a Collection.
This includes uploading images into a field in the Collection.
These images are given a very long/obscure URL and do not appear in the Site Editor image store.
My question is - what happens to the image storage used when the row in the Collection is deleted?
I hope it is automatically 'garbage collected'! I don't want to find that I run out of space after years of operation!!
Thank-You
the code to upload the image is:
export function saveButton_click_1(event) { if ($w("#myUploadButton").value.length > 0) { // user chose a file //console.log(`Uploading '${$w("#myUploadButton").value[0].name}'`); $w("#myUploadButton").startUpload() .then( (uploadedFile) => { //console.log("Upload successful. File is available here:"); //console.log(uploadedFile.url); $w("#image1").src = uploadedFile.url; let toSave = { title: $w("#StockNumber").value, image: $w("#image1").src, description: $w("#Description").value , price: $w("#Price").value, sold: $w("#Sold").value , new: $w("#NewIn").value , stock: $w("#Stock").value }; wixData.save("Stock", toSave) } ) .catch( (uploadError) => { console.log(`File upload error: ${uploadError.errorCode}`); console.log(uploadError.errorDescription); } ); } }
Hello Adas
I am uploading images in a Page using the wix explicit 'upload image' button
export function saveButton_click_1(event) { if ($w("#myUploadButton").value.length > 0) {
// user chose a file
//console.log(`Uploading '${$w("#myUploadButton").value[0].name}'`); $w("#myUploadButton").startUpload()
.then( (uploadedFile) => {
//console.log("Upload successful. File is available here:");
//console.log(uploadedFile.url);
$w("#image1").src = uploadedFile.url;
let toSave = {
title: $w("#StockNumber").value,
image: $w("#image1").src,
description: $w("#Description").value ,
price: $w("#Price").value,
sold: $w("#Sold").value ,
new: $w("#NewIn").value ,
stock: $w("#Stock").value }; wixData.save("Stock", toSave) } )
.catch( (uploadError) => {
console.log(`File upload error: ${uploadError.errorCode}`);
console.log(uploadError.errorDescription); } ); } }
This image is not stored in the Media Manager (or more accurately - I can not find it there!)
However, whilst I can use this Page to update/edit records in my Collection in Preview mode it
does NOT update the Collection if I use it in my Published Site. I have checked Permissions -
which are all set to Anyone.
So I appear to have two problems - garbage collection on my uploaded images, and with
wixData.save("Stock', toSave) only seems to work in Preview Mode.
Help required - this is a major, major issue for me
David
The URL is just a 'pointer' and yes indeed when a row is deleted the image url is deleted - I want to confirm that the image itself is deleted, and does not remain in my wix site memory storage.
Thank-you
Hey,
The image URL is saved in a collection, and not in the Media Manager. Therefore, when deleting a row in a collection, it is removed from the collection and not saved in the Media Manager.
I hope it's clear.
Best,
Tal.