<script type="text/javascript">
ej.Uploadbox.prototype._xhrOnUploadButtonClick = function (e) {
var xhrUpload = this;
var form_data = new FormData();
var ins = this.inputupload[0].files.length;
for (var x = 0; x < ins; x++) {
form_data.append(this.control.id+"_data", this.inputupload[0].files[x]);
}
$.ajax({
url: this.model.saveUrl,
dataType: 'text',
cache: false,
contentType: false,
processData: false,
data: form_data,
type: 'post'
});
this._dialogclose()
};
</script> |
"Hi!
Thanks for trying to help.
But the problem still exists.
For example here I choose few files and press upload button.
I see one request, but only with one file.
At this line of your code:
var ins = this.inputupload[0].files.length;
Variable "ins" always equals 1.
And in the controller action:
Collection"files" respectively consist only one file.
Hi Prince,
Thanks for video.
If I select several files from one folder at once, like on a video - then everything is ok.
But if after that I want to add more files and press the "Browse "button again, then not all files will be sent in reality.
Also, if after sending the files I go again to select other files without page reloading - the previous files are sent again, and not the ones I just selected.
<script type="text/javascript">
ej.Uploadbox.prototype._xhrOnUploadButtonClick = function (e) {
var xhrUpload = this;
var form_data = new FormData();
var ins = $("input.e-uploadinput")[0].files.length;
for (var x = 0; x < ins; x++) {
form_data.append(this.control.id + "_data", $("input.e-uploadinput")[0].files[x]);
}
$.ajax({
url: this.model.saveUrl,
dataType: 'text',
cache: false,
contentType: false,
processData: false,
data: form_data,
type: 'post'
});
this._dialogclose()
};
</script> |
constructor() {
ej.Uploadbox.prototype["_xhrOnUploadButtonClick"] = function (e) {
var xhrUpload = uploadObj;
var form_data = new FormData();
var ins = $("input.e-uploadinput")[0].files.length;
for (var x = 0; x < ins; x++) {
form_data.append(uploadObj.control.id + "_data", $("input.e-uploadinput")[0].files[x]);
}
$.ajax({
url: uploadObj.model.saveUrl,
dataType: 'text',
cache: false,
contentType: false,
processData: false,
data: form_data,
type: 'post'
});
uploadObj._dialogclose()
}
} |
Hi Divyesh,By default, the default Uploadbox will allow for multiple upload but not in a single request. As mentioned earlier updates, source can be overridden for this. As the same JS code alone is to be overridden, the format in which the code is to be included alone varies with Angular. Include the method as shown below within constructor of TS file.
constructor() {ej.Uploadbox.prototype["_xhrOnUploadButtonClick"] = function (e) {var xhrUpload = uploadObj;var form_data = new FormData();var ins = $("input.e-uploadinput")[0].files.length;for (var x = 0; x < ins; x++) {form_data.append(uploadObj.control.id + "_data", $("input.e-uploadinput")[0].files[x]);}$.ajax({url: uploadObj.model.saveUrl,dataType: 'text',cache: false,contentType: false,processData: false,data: form_data,type: 'post'});uploadObj._dialogclose()}}Please let us know, if you have any concern on this.Regards,Ashokkumar B.