Filename of uploaded image change hover or pop up

Hi All

First im uploading images through form i created.

The code is working fine to save and display the images from database row to gallery but the filename change, im guessing the url of image which shows in the image/ gallery when hover or pop up.

Can someone help me to find ways on to display the original name of the file when uploading it. Im exhausted from trying so many combination yet its not working.
Your help is much appreciated.

Thanks,
DA

Have you try to add hook before insert?

Hi DA,

You can get the file name currently ready to be uploaded by calling $w(‘#uploadButton1’).value[0][‘name’].
Unfortunately the file name is lost after you click the submit button and is overridden by an internal name, therefore using a hook will not work here.

Hi Ido & Heson

I am using this code

export function button1_click(event) {
if($w(“#uploadButton1”).value.length > 0) {
$w(“#text1”).text = Uploading ${$w("#uploadButton1").value[0].name}; $w(“#uploadButton1”).startUpload()
.then( (uploadedFile) => {
$w(“#text1”).text = “Upload successful”;
$w(“#image1”).src = uploadedFile.url; })
.catch( (uploadError) => {
$w(“#text1”).text = “File upload error”;
console.log(Error: ${uploadError.errorCode});
console.log(uploadError.errorDescription);
});
}
else {
$w(“#text1”).text = “Please choose a file to upload.”;
}
}

it work fine but filename become jdsjj123k1k3ll2…jpg, the original filename is overide. Any way I can display the original filename?

thanks in advance,
DA