Intercepting Upload Action

Is it possible to intercept the upload action to pass in an extra parameter such as a boolean?  I see there is beforeDownload, but I don't see beforeUpload.

Thanks,
    William V.

1 Reply 1 reply marked as answer

SP Sowmiya Padmanaban Syncfusion Team August 12, 2020 10:47 AM UTC

Hi William, 
 
Greetings from Syncfusion support. 
 
We have checked your requirement with FileManager component. Yes, you can able to send the additional parameter to Upload action by using beforeSend event of FileManager component. 
 
Refer the below code snippet. 
 
    let hostUrl: string = 'http://localhost:62869/'; 
    let fileObject: FileManager = new FileManager({ 
        ajaxSettings: { 
            url: hostUrl + 'api/FileManager/FileOperations', 
            getImageUrl: hostUrl + 'api/FileManager/GetImage', 
            uploadUrl: hostUrl + 'api/FileManager/Upload', 
            downloadUrl: hostUrl + 'api/FileManager/Download' 
        }, 
        view: 'Details',  
        beforeSend: function(args) { 
            var data = JSON.parse(args.ajaxSettings.data);  
          if (args.action == "Upload") {  
            // Allow custom data for upload operations   
            data.push({ 'custom_attribute': true });  
            args.ajaxSettings.data = JSON.stringify(data);  
         } 
        } 
    }); 
    fileObject.appendTo('#filemanager'); 
 
You can fetch this attribute in your server side. Refer the below screenshot. 
 
 
 
Refer the below sample and service link of FileManager component. 
 
 
 
Similarly, we can send additional attribute to the all the  file operations (Read, Delete, copy, move, download, getImage) of FileManager component. 
 
Refer to the below similar forum links for sending additional parameter to server side. 
 
 
 
Refer the below links to know more about the FileManager component. 
 
 
 
 
Please let us know, if you need any further assistance. 
 
Regards,  
Sowmiya.P 


Marked as answer
Loader.
Up arrow icon