Hi suipport,
the code is nothing special, its just from your example in the docs.
// Initialize the control by preload files
var uploadObj = new ej.inputs.Uploader({
asyncSettings: {
saveUrl: 'Url::base(false)?>/file/filesave',
removeUrl: 'Url::base(false)?>/file/fileremove',
},
multiple: false,
files: $filesJS ?>,
uploading: onFileUpload,
removing: onFileRemove,
dropArea: dropElement
});
uploadObj.appendTo('#fileupload');
function onFileRemove(args) {
// removeFile = [];
// args.cancel = true;
args.customFormData = [{'= Yii::$app->request->csrfParam; ?>' : '= Yii::$app->request->csrfToken; ?>'}];
// removeFile.push(args.filesData);
// dialog.show();
}
function onFileUpload(args) {
// add addition data as key-value pair.
args.customFormData = [
{'= Yii::$app->request->csrfParam; ?>' : '= Yii::$app->request->csrfToken; ?>'},
{'filefolderid' : = $filefolderid ?>},
];
}
A video would be too long as you have to go to the developer console of the browser to examine the request parameters.
As I told you before, two different requests are sent depending on the way the remove action is triggered.
These following results are from the developer console of firefox:
First case:
Removing the file directly after uploading it (without refreshing the page).
It looks like the first request (from uploading the file) is resend but to a different url.
The console says the request parameters are::
-----------------------------20552003275751002131175567001
Content-Disposition: form-data; name="UploadFiles"; filename="test2.pdf"
Content-Type: application/pdf
%PDF-1.7
%äãÏÒ
3 0 obj
<>
stream
...
...
etc till end of pdf file
Second case:
The console says the request parameters are:
Removing the file after refreshing the page manually:
-----------------------------428142423628998047754271717332
Content-Disposition: form-data; name="UploadFiles"
2020_LRVBW_Aufsichtspflichtübertragung_Druck.pdf
-----------------------------428142423628998047754271717332
Content-Disposition: form-data; name="_csrf"
7TFst_OcuQeXn58XIT9vN7jKPZRggt65n6TF66BBACaIf1zixvjLSN7u1HRDYARg8rxU8wrPkNrP6KPZxR5pXA==
-----------------------------428142423628998047754271717332--
This looks very different to me.
Regards,
Stephan