Hi Haris,
Greetings from Syncfusion support.
We have reviewed your query and understand that you are
looking to pass a JWT token for the EJ1 FileExplorer control upload operation.
We would like to inform you that our EJ1 products have been declared as retired
products since our Volume 4 SP release in 2022, and we will not make any
improvements to the EJ1 components. Refer to the below release notes for
further reference.
Release
Notes:https://help.syncfusion.com/js/release-notes/v20.4.0.44?type=all
However, We also recommend considering the use of the EJ2
FileManager component to see if it achieves the exact requirement from your
side. We have included a link to the EJ2 FileManager component demo and
documentation for your reference.
The EJ2 FileManager component has many features and
capabilities, and it is compatible with the EJ1 controls. We have also included
a link to our compatibility documentation for your reference.
Compatibility documentation: https://help.syncfusion.com/js/compatibility-ej1-ej2
EJ2 demo: https://ej2.syncfusion.com/javascript/demos/#/material3/file-manager/overview.html
EJ2 documentation: https://ej2.syncfusion.com/javascript/documentation/file-manager/es5-getting-started
However, to achieve your mentioned requirement in the EJ1
File Explorer, you can use the beforeUploadSend
event to pass the Authorization header value from the client to the server.
Refer to the below code snippets.
|
[FileExplorer.html]
…
<body>
<div id="fileExplorer"></div>
<script>
$(function () {
var fileSystemPath = http://localhost:51460/FileBrowser/;
var ajaxActionHandler = http://localhost:51460/fileexplorer/fileoperation/doJSONAction;
$("#fileExplorer").ejFileExplorer({
path: fileSystemPath,
ajaxAction: ajaxActionHandler,
beforeUploadSend: function (args) {
args.xhr.setRequestHeader("Authorization", "FileExplorer");
}
});
});
</script>
</body>
</html>
[FileOperationController.cs]
public object doJSONAction()
{
var header=
Request.Headers.Authorization;
FileExplorerParams args = FileExplorerOperations.GetAjaxData(Request);
if
(args.ActionType == "Upload")
{
FileExplorerOperations.Upload(args.Files, args.Path);
return new HttpResponseMessage()
{ Content = new StringContent("ok", Encoding.UTF8, "text/plain") };
}
…
}
|
For your reference, we have attached the sample.
Sample: Attached as a zip file.
Check out the shared details and let us know if you need any
further assistance.
Regards,
Prasanth Madhaiyan.
Attachment:
Sample_afe23415.zip