Hi Jyoti,
Greetings from syncfusion support.
From the shared details, we understand that you want to pass
custom data like a form to the server side while performing an Upload
operation in the FileManager component. We have prepared a simple sample of the
React FileManager component with the physical service provider.
To achieve your requirements, we suggest you pass the form
data as a JSON string format in the FileManager beforeSend
event and get the data on the server side as mentioned in the below code
snippet. We have attached the modified sample to your reference.
Refer to the below code snippet.
[Index.js]
onbeforeSend(args) {
if (args.action == 'Upload') {
//Ajax
beforeSend event
args.ajaxSettings.beforeSend = function (args) {
//Setting authorization header
var data = { Name: 'Syncfusion' };
var myJSON = JSON.stringify(data);
args.httpRequest.setRequestHeader('Authorization', myJSON);
};
}
}
|
[PhysicalFileProvider.cs]
public class my
{
public string Name { get; set; }
}
...
[Route("Upload")]
public
IActionResult Upload(string path, IList<IFormFile> uploadFiles, string action)
{
var root =
HttpContext.Request.Headers["Authorization"];
var def =
JsonConvert.DeserializeObject<my>(root);
var myroot =
def.Name;
|
Sample: https://stackblitz.com/edit/react-g7snc2-kpnabc?file=index.js
Service provider: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ej2-aspcore-file-provider-master771724235.zip
Please check the shared details and get back to us if you
need any further assistance.
Regards,
Sivakumar S