warning: startUpload is deprecated

@yisrael-wix here the code under the button.

I’ve alse tried your workaround and it works… but I have a strange behaviour on other fields which remains blank, while some days ago they were correctly populated. More than 70 users used this page with no problems until some days ago, so the code should be ok.

export function button1_click ( event ) {
$w ( ‘#Wait’ ). show ();
$w ( ‘#UploadImage’ ). expand ();
$w ( ‘#button1’ ). hide ();
$w ( ‘#button1’ ). disable ();
$w ( ‘#uploadButton1’ ). disable ();

$w ( ‘#DBAutori’ ). setFieldValue ( ‘attivo’ , $w ( ‘#attivo’ ). checked );
$w ( ‘#DBAutori’ ). setFieldValue ( ‘title’ , $w ( ‘#title’ ). value );
$w ( ‘#DBAutori’ ). setFieldValue ( ‘nomecognome’ , $w ( ‘#nome’ ). value + ’ ’ + $w ( ‘#cognome’ ). value );
$w ( ‘#DBAutori’ ). setFieldValue ( ‘tipoArtistaText’ , $w ( ‘#tipoartista’ ). value );
$w ( ‘#DBAutori’ ). setFieldValue ( ‘tipoArtista’ , $w ( ‘#IDtipoartista’ ). value );

if ( $w ( ‘#dropdown2’ ). value === “Testata Regionale” ) {
$w ( ‘#DBAutori’ ). setFieldValue ( ‘regione’ , $w ( ‘#inputRegione’ ). value );
}

if ( $w ( ‘#dropdown2’ ). value === “Testata Locale” ){
$w ( ‘#DBAutori’ ). setFieldValue ( ‘regione’ , $w ( ‘#inputRegione’ ). value );
$w ( ‘#DBAutori’ ). setFieldValue ( ‘provincia’ , $w ( ‘#inputProvincia’ ). value );
$w ( ‘#DBAutori’ ). setFieldValue ( ‘borgo’ , $w ( ‘#inputBorgo’ ). value );
}
$w ( ‘#text45’ ). hide ();
}

@yisrael-wix update: upload button is working properly in test, but not in prod.
I’m waiting for the customer care to open to have a call.
Thanks

Guys, I also get this warning, but I haven’t connected any buttons to the dataset, I’ve done it all in code, and here it’s working.
Here is the code for my submit button:


export async function btnEnviar_click ( event ) {
$w ( “#progressBarEnviar” ). show ();
$w ( “#imgLoadEnviar” ). show ();
$w ( “#btnFechar” ). hide ();
$w ( ‘#progressBarEnviar’ ). targetValue = 100 ;

$w ( '#progressBarEnviar' ). value  =  20 ; 

await wixData . get ( “MembrosExtra” , id )
. then ( item => {
item . fotoIdentidade = imgRGfrente ;
item . fotoIdentidadeVerso = imgRGverso ;
item . fotoEndereco = imgComprovante ;
item . fotoSelfie = imgSelfie ;
$w ( ‘#progressBarEnviar’ ). value = 50 ;
return wixData . update ( “MembrosExtra” , item )
. then (( ok ) => {
$w ( “#btnLimpaRGfrente” ). hide ();
$w ( “#btnLimpaRGverso” ). hide ();
$w ( “#btnLimpaComprovante” ). hide ();
$w ( “#btnLimpaSelfie” ). hide ();
$w ( “#imgLoadEnviar” ). hide ();
$w ( “#progressBarEnviar” ). style . foregroundColor = “#28B463” ;
$w ( ‘#progressBarEnviar’ ). value = 100 ;
$w ( “#btnEnviar” ). label = “Fotos Enviadas com Sucesso!”
$w ( “#btnEnviar” ). disable ();
}). catch (( error ) => {
$w ( “#txtErro” ). show ();
console . log ( error );
})
})
. catch (( err ) => {
$w ( “#txtErro” ). show ();
console . log ( err )
})
$w ( “#btnFechar” ). show ();
}

thanks! I have also done it all with code, and as I said - it works 90-95% of the cases. I’m not sure that this error is related to my customer’s issues with my upload buttons, but I’m waiting to see an update from Wix in the API reference to prepare my sites before it’s too late.
In your code I couldn’t see the upload function - did you use startUpload() or uploadFiles() ?

@shimistudio I used the start Upload.
I don’t know how many tests you find interesting, here I did more than 30 tests in production and they all worked.


export async function btnUpRGfrente_change ( event ) {
$w ( “#btnUpRGfrente” ). buttonLabel = “Selecionar Foto” ;
$w ( “#btnUpRGfrente” ). fileType = “Image” ;
$w ( ‘#progressBarRgfrente’ ). style . foregroundColor = “#00A6FF” ;
$w ( ‘#progressBarRgfrente’ ). show ();
$w ( “#imgLoadRgFrente” ). show ();
$w ( ‘#progressBarRgfrente’ ). targetValue = 100 ;

$w ( '#progressBarRgfrente' ). value  =  20 ; 

await $w ( “#btnUpRGfrente” ). startUpload ()
. then (( RGfrente ) => {
imgRGfrente = RGfrente . url ;
$w ( “#imgRgFrente” ). src = imgRGfrente ;
$w ( “#imgRgFrente” ). show ();
$w ( “#imgLoadRgFrente” ). hide ();
rgFrente = true ;
$w ( ‘#progressBarRgfrente’ ). value = 100 ;
$w ( “#btnLimpaRGfrente” ). show ();
$w ( “#btnUpRGfrente” ). buttonLabel = “Arquivo Carregado” ;
$w ( ‘#btnUpRGfrente’ ). disable ();
verUps ();

})
. catch (( err ) => {
$w ( “#btnUpRGfrente” ). buttonLabel = “Formato Inválido” ;
$w ( “#btnLimpaRGfrente” ). show ();
$w ( “#imgLoadRgFrente” ). hide ();
$w ( ‘#progressBarRgfrente’ ). value = 10 ;
$w ( ‘#progressBarRgfrente’ ). style . foregroundColor = “red” ;
$w ( ‘#progressBarRgfrente’ ). show ();
});

}

Hi all,
here an update.
Customer care says that the message is a warning, so it’s not the cause of the problem, BUT after 1 day of work and test I can say that something really changed under the file-upload button and in the startUpload function.
(one of the new functionalites on which wix is working is the multiple file upload… ops… maybe anything is connected?)

All the pages of my site stopped working and started a completely new behaviour preventing 80% of my side to work.
Considering I was in the lunch phase with 100 users registered and marketing campains live… what can I say?
I fully tested the site for months and no problem was present. Today no user is able even to upload a file.
Of course this could be fixed somehow… but at what price? Re-engineering the whole site? :frowning:

@yisrael-wix HI!
You can check also this post as other users have the same problem and it is not solved yet!
https://www.wix.com/velo/forum/coding-with-velo/form-image-is-not-saving-to-database

In my code, for now it’s really just a warning, it must be because they’re working on it:
https://www.wix.com/velo/requested-feature/multiple-file-upload-button

@hendersonberigo the problem is that the behaviour of the button has changed and now I have a lot of problems on my site :frowning:
If you connect the button to a dataset a lot of people have problems : “If I leave the upload button connected to the other elements like text input, the submit does not work. As soon as I disconnect the upload button the submit works again”

Same proplem here. Upload button works fine untill i try to attach an image with startUpload(). it was working perfectly for a month or so, i haven’t tried to attach any pics during last week, so i don’t know when the problem first occured. but today i have noticed this warning in the console: “Wix code SDK warning: startUpload is deprecated. Please use uploadFiles instead.”
here’s my code for the image upload:

export function btnUploadLogo_change(event) {
 
 if ($w('#btnUploadLogo').value.length > 0) {
 let file = $w('#btnUploadLogo').value;
 let fileSize = file[0].size;
 
 if (fileSize < 25000000) {
            $w('#btnUploadLogo').startUpload()
                .then(uploadedFile => {
                    $w('#imgLogo').fitMode = 'fit';
                    $w('#imgLogo').src = uploadedFile.url;
 
                    $w('#txtImageError').hide();
                    $w('#btnUploadLogo').buttonLabel = 'Photo is ready for upload';
                    $w('#btnSubmit').enable();
                    $w('#btnSubmit').label = 'Submit';
                })
                .catch( (uploadError) => {
                    console.log("File upload error: " + uploadError.errorCode);
                    console.log(uploadError.errorDescription);
                });
 } else {
            $w('#txtImageError').show();
            setTimeout(()=>{
                $w('#txtImageError').hide()
 },5000);
            $w('#btnSubmit').enable();
            $w('#btnSubmit').label = 'Сохранить';
 }
 }
}


and here’s an error i get in the console:
save operation failed: rcode: "DS_OPERATION_CANCELLED"Symbol(error was handled): trueSymbol(error-boundary-scope): "userCodeZone"message: "Operation cancelled by user code.
TypeError: Cannot read property ‘then’ of undefined"name: "DatasetError"stack: "DatasetError: Operation cancelled by user code. TypeError: Cannot read property ‘then’ of undefined\n at https://static.parastorage.com/services/dbsm-viewer-app/1.3546.0/app.js:1:225593"proto: r

Exactly! But in other pages of my site also the bahaviour in combnation with other input fields has changed.
@gugalackunt : try to use the same button in PREVIEW SITE without changing anything and let me know if it works.

@autore Ha, you know, actually it worked without any errors and added an item into the sandbox dataset

@gugalackunt Yes! IN PREVIEW everything is still the same… and my site in production is completely KO! :frowning:

The “deprecated” warning is only to indicate an update to the API (and the API docs), but that the API still works as it should.

If this is not working for you, then you will need to find the error in your code.

yep, as i see, startUpload() is working fine and catchs no errors, but the submit button (which doesn’t have any code, it is just connected to the dataset with the submit function chosen in the button settings) gives the error (“save operation failed”. " message : “Operation cancelled by user code. TypeError: Cannot read property ‘then’ of undefined”" ). The only code that i have which is associated with the image i have posted up there. It seems that the submit button started to work somehow differently lately.

$w(‘imgLogo’) and $w(‘btnUploadLogo’) ar also connected to the dataset

@yisrael-wix Hi and thanks for your help!
The code is working perfectly in PREVIEW mode with no errors.
In production is not working anymore in all pages.
Same for other users, so it’s clear that WIX did something on the upload button since 10 days.
Best option is that WIX makes a rollback at the same version of PREVIEW / SANDBOX to fix the problem. It’s a lot of work to change and test all my site with the potential action that if WIX makes a rollback I’ll need to test it double.
Thanks

What is the URL? How and where to see the problem?

@gugalackunt What is the URL? How and where to see the problem?

@yisrael-wix This is the link to my dashboard https://nshportuk.wixsite.com/website/dashboard , First login with the following credentials (***) it will redirect you back to dashboard and you need to press the middle button with your name on it :slight_smile: . Then you will get to the problematic page. On the right you will see a purple image upload button (btnUploadLogo) again with your name on it. after this go to bottom to check the blue submit button.

@gugalackunt OK, I’m looking at it and I’m checking with QA.

(I modified your post to delete the credentials)