Passing Additional params to Template

Hi,

I'm trying to create a custom template for the file uploader and I'd like to pass additional parameters to the template, like the file's URL, so the user can click it and open the file from the server. How can I achieve that?


3 Replies

UD UdhayaKumar Duraisamy Syncfusion Team June 6, 2022 04:17 PM UTC

Hi Christian,


We are validating the requirement. We will update the details in two business days (8th June 2022).


Regards,

Udhaya Kumar D.



UD UdhayaKumar Duraisamy Syncfusion Team June 8, 2022 05:44 PM UTC

Hi Christian,


Due to complexity, we are still validating the requirement. We will update the details in two business days (10th June 2022).


Regards,

Udhaya Kumar D.



UD UdhayaKumar Duraisamy Syncfusion Team June 12, 2022 01:29 PM UTC

Hi Christian,


We have prepared a sample using a custom template and attached it below for reference. Please refer to the code snippet and documentation for more details.


onUploadSuccess: function(args) {

        let li= document.getElementById('dropTarget').querySelector('[data-file-name="' + args.file.name + '"]');

        li.appendChild(createElement('a',  { className: 'file-lists', attrs: {rel='nofollow' href : 'https://localhost:44358/Home/download?='+args.file.name,target:'blank'},innerHTML:'Download' }));

        if (!isNullOrUndefined(li.querySelector('.progress-bar-container'))) {

            detach(li.querySelector('.progress-bar-container'));

        }

 


In the above code snippet, we have added an ‘a' tag on the success event of the uploader component. By appending the uploaded file name to the rel='nofollow' href link, we can download those files from the server.


Documentation : Custom template

                             Add Additional Data on Upload in Vue Uploader component


Regards,

Udhaya Kumar D.


Attachment: App_dab34b38.zip

Loader.
Up arrow icon