Hi Team,
We need to perform custom upload operation where in we want to send 2 extra parameters in the Upload AJAX request as shown below.
First we want to select the file from custom explorer dialog which opens up when Browse button is clicked and then select the values for destination path and access group from dropdown.
After selecting all parameters we want to validate it and send the Upload AJAX request on click of OK button from our custom dialog.
|
beforeSend: function(args) {
// Get the value you want to pass.
var value = "Destination";
if (args.action == "Upload") {
// Allow custom data for upload operations
data1.push({ 'column': value });
args.ajaxSettings.data = JSON.stringify(data1);
}
} |
Hi Indumathy,
This is related to File manager control and the file upload operation within. We have added a custom input dialog for upload operation rather than using the default one.
On the upload button click we have opened a custom dialog where we can explore files and enter custom related data for request input.
We are selecting files using : in UploadFileDialogComponent.html
and collecting the files after closing the custom dialog. After this we want to hit the Upload Ajax request directly with collected data as shown in previously shared snapshot of upload .Hope we have any provision for this
Thanks,
Rohit Swarup
|
<ejs-uploader #defaultupload id='defaultfileupload' allowedExtensions="image/*" [multiple] = false[autoUpload] = false[asyncSettings] = 'path'
(selected) = 'onFileSelect($event)'(uploading) = "OnUpload($event)" ></ejs-uploader >
public OnUpload(args) {
var username = 'Syncfusion';
args.currentRequest.setRequestHeader('Authorization', 'Bearer ' + username);
args.currentRequest.setRequestHeader('Destination', this.textbox1Val);
args.currentRequest.setRequestHeader(
'Access-control-group',
this.textbox2Val
);
} |
Hi,
In the sample you provided, the OK button handler is not working.
Once I select a file I can see it inside the input field and when I click Ok button nothing happens further.(No API being called)
Also When I tried this code with my original application, after file selection the upload files dialog is coming up automatically when autoUpload=false and when autoUpload=true, the file upload API being called immediately after selecting the file in selection dialog.
I don't want to see this Upload Files dialog and automatically hit the Upload action on click of "Ok" button.
Thanks,
Rohit Swarup
Hi,
could you please update on this.
Thanks
|
// uploads the file(s) into a specified path
[Route("Upload")]
public IActionResult Upload(IList<IFormFile> uploadFiles, string action, IFormCollection form)
{
var data = Request.Form["path"];
var path = data.ToString().Replace("/", "\\");
try
{
foreach (var file in uploadFiles) {
var filename = ContentDispositionHeaderValue
.Parse(file.ContentDisposition)
.FileName
.Trim('"');
filename = this.basePath + "\\" + this.root + path + "\\" + $@"\{filename}";
if (!System.IO.File.Exists(filename))
{
using (FileStream fs = System.IO.File.Create(filename))
{
file.CopyTo(fs);
fs.Flush();
…
...
return Content("");
} |
|
this.toolbarSettings = {
items: [
'NewFolder',
'CustomUpload',
'Delete',
'Download',
'Rename',
'SortBy',
'Refresh',
'Selection',
'View',
'Details'
]
};
...
toolbarClick(args) {
if (args.item.text === 'CustomUpload') {
this.ejDialog.show();
}
}
public okayClick() {
document
.getElementsByClassName('e-upload-actions')[0]
.querySelector('button.e-file-upload-btn')
.click();
this.uploadObj.upload();
return false;
} |