I have a kendo upload on my page where users can upload multiple files. It is NOT set to batch mode, so each file is uploaded individually. I need to use the same upload and the same set of files on two different endpoints. For the first endpoint, I need to upload only the first file. For the second endpoint, I need to upload every file (including the first one). I have two separate buttons that will trigger these. There is also some custom data that I need to include from other controls on the page (like a name, address, etc). How would I accomplish this?
Button 1: Upload the first file to Endpoint A with extra data Y
Button 2. Upload all of the files to Endpoint B with extra data Z
This is the actual flow
1. Select all files
2. Analyze First File (upload only the first file to the server)
3. Server responds with some info about the file ({ type: "text", "author: "John Smith", creditor: "Wells Fargo", etc }
4. This data is placed in some inputs on the page where the user can change it, for example, the system says the author is John Smith but it is really Jane Doe. In my scenario, all files must use the same data regardless of what files 2 through X may contain, so even if Jack Jackson's name appears in File 2, we are using Jane Doe. This whole process is really just to make it easier when the user fills out the data form so that they just update the stuff that is wrong.
5. After the user approves the data in the inputs, they click a submit button. At this time, all of the files are uploaded along with the edited input data object {type: "text", author: "Jane Doe", creditor: "Wells Fargo", etc }
Example:
Upload:
[ Select Files...]
[ Test First File ]
Fill out the form:
Type: _________
Author: _________
Creditor: _________
Click the button below to upload all files using the data entered in the form.
[ Upload Files ]
let uploadedFiles = new kendo.data.ObservableArray([]);
$("#fileInput").kendoUpload({
async: {
autoUpload: false
},
validation: {
allowedExtensions: [".jpg", ".jpeg", ".png", ".xlsx"]
},
multiple: true,
batch: true,
showFileList: true,
select: onSelect,
remove: onRemove
});
function onSelect(e) {
const files = e.files;
const previewContainer = $("#imagePreviewContainer");
// Loop through selected files and add them to the uploadedFiles array
files.forEach(file => {
uploadedFiles.push(file);
};
i am using this but when i selected multiple files like images then all selected files are come into bulk in one array i want that in seperately one by one
After selecting a file in kendoUpload two buttons show up: Upload and Clear:
Is it possible to hide those two buttons? I want to do the upload process programmatically.
I already found out that the two buttons are not accessible after initialization of the kendoUpload widget but also not right away after the SELECT event triggers (on selecting a file to be uploaded). I have found a solution waiting some milliseconds in the SELECT event to hide the two buttons:
setTimeout(function() {
$('k-actions').css('display', 'none');
}, 10);
Is there a more proper way to hide those buttons?
I'm working with KendoUI for JQuery, very latest official version.
Regards
Hi,
We've using a Form component with an Upload component in it. The validation within the Upload works fine but we'd like to check whether a file has been uploaded and / or selected. The "required" part of the Form validation doesn't seem to trigger when no file is selected. Code provided is an item in the Form.
{
field: "mailingList",
label: "Mailing List",
colSpan: 2,
editor: function (container, options) {
$('<input type="file" name="' + options.field + '" id="' + options.field + '"/>').appendTo(container)
.kendoUpload({
async: {
saveUrl: "/rates-notices-campaign/save-attach/" + id,
removeUrl: "/rates-notices-campaign/remove-attach/" + id,
autoUpload: true
},
validation: {
allowedExtensions: [".csv", ".xlsx"]
}
});
},
validation: {
required: {
message: "Mailing List is required"
}
}
}
Thanks
I use the upload widget in a long-running web app to allow picture upload.
Over the years, the number and size of pictures have increased.
I compress property in the upload widget would be great, however, short of this, has anyone played around with compressing images in the browser in connection with using the upload widget?
/Morten
Hello,
is there a way to implement an upload directly from browser to S3 bucket using Kendo JQuery component?
It's possible with JS, but the idea is to use fancy Upload component with drag-n-drop and progress bar.
Thanks in advance.