Hey wix team,
Is it possible to deactivate or hide the cancel upload button (x) during a upload operation. I have developed a custom delete option after upload for the upload button and now this x button is redundant and looks unwanted in my upload operation. So is it possible to deactivate it through code or through a feature update from wix side? Thanks.
@Anand Hi - It looks as you've posted in few different threads some code with the 'databaseNumberOfImages' option, maybe you could help.. Basically I'm trying to limit the number of images that a single user can upload in a single session (let's say 2). I know I need to use session from wix-storage, but as I'm not heavy on coding, I couldn't make it right.
Currently an upload to a 'Wix Pro Gallery' is being made via an 'upload button' and a 'button' which inserts the single uploaded image into a Dataset. Any idea how the combination between session and 'databaseNumberOfImages' works within my code?
Here's the part of my code which handles the upload:
import wixData from 'wix-data'; export function checkbox1_change(event, $w) { //ensures T&Cs box is ticked, otherwise 'Upload' button is disabled. if($w("#checkbox1").checked===true){ $w("#button1").enable(); $w("#dataset1").setFieldValue("agreedTCs",true); $w("#dataset1").save(); } if($w("#checkbox1").checked===false){ $w("#button1").disable(); } } export function button1_click_1(event) { //Upload button to select a photo if ($w("#uploadButton1").value.length > 0) { $w("#text19").text = `Uploading ${$w("#uploadButton1").value[0].name}`; setTimeout(function() { // $w("#text19").text = "Almost there... " }); $w("#uploadButton1").startUpload() .then( (uploadedFile) => { $w("#text19").text = "Upload successful"; let toInsert = { "MyPhoto": uploadedFile.url }; wixData.insert("DD", toInsert) //Inserting the uploaded photo into the DB .then( (results) => { let item = results; }).then(()=>{ $w("#dataset1").refresh(); }); }) .catch( (uploadError) => { $w("#text19").text = "File upload error"; console.log(`File upload error: ${uploadError.errorCode}`); console.log(uploadError.errorDescription); } ); }
Thanks!
Hey Sailen..
Sorry for the late reply... Wix forum is not yet matured to notify users about direct replys to forum post.....
BTW Here is the code...
export function imagedeletebutton_click(event, $w) { let items = $w("#gallery").items; let currentgallerindex = $w("#gallery").currentIndex; $w("#imagedeletebutton").show(); items.splice(currentgallerindex, 1); $w("#gallery").items = items; if (items.length === 0) { $w("#imagedeletebutton").hide(); } if (items.length <= databaseNumberOfImages) { $w("#uploadButton").show(); } for (let i = 2; i <= databaseNumberOfImages; i++) { let fieldname = "pic" + i; $w("#sellandbuydataset").setFieldValue(fieldname, undefined); } }
hello Nithin,
Please share that custom delete option after upload ....m in need for that .TY.