drag and drop bulk upload and validations

4 posts, 1 answers
  1. Member12221
    Member12221 avatar
    5 posts
    Member since:
    Jul 2017

    Posted 13 Jul 2017 Link to this post

    I'm using kendo upload and want to know how I can validate the bulk upload on file size. (I don't need to upload files which are sized more than 3 MB, but the other files should upload). I have done it in the following way and it drops out the file which is too big and fails to upload the other documents which comes after the error file.

        <div class="demo-section k-content">
            .Async(a => a
                .Save("ChunkSave", "FileUpload")
                .Remove("Remove", "FileUpload")
            .Validation(validation => validation.AllowedExtensions(new string[] { ".docx", ".doc", ".pdf" }))
            .Validation(validation => validation.MaxFileSize(3145728))
            .Events(events => events

    Let me know if there is a way to only drop the files which are in error state (too big, doc type)

  2. Answer
    Ivan Danchev
    Ivan Danchev avatar
    2063 posts

    Posted 17 Jul 2017 Link to this post


    I tested the Upload's behavior using your configuration and as you can see in this short screencast the file that does not pass the validation (larger than 3MB) does not prevent the other file (smaller than 3MB) from being uploaded. Are there any other steps that we need to followed in order to reproduce the issue or custom logic in the Upload's event handler that might be interfering with the Upload's default behavior? I tested it with no handlers attached, but I can see from the code snippet you posted that you are attaching event handlers for many of the Upload's events.

    Ivan Danchev
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Member12221
    Member12221 avatar
    5 posts
    Member since:
    Jul 2017

    Posted 18 Jul 2017 in reply to Ivan Danchev Link to this post

    Hi Ivan, 

    Thanks a lot for the quick response. I have the following controller code which i took from chunk save example. 

            public ActionResult ChunkSave(IEnumerable<HttpPostedFileBase> files, string metaData)
                if (metaData == null)
                    //return Save(files);

                MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(metaData));
                var serializer = new DataContractJsonSerializer(typeof(ChunkMetaData));
                ChunkMetaData chunkData = serializer.ReadObject(ms) as ChunkMetaData;
                string path = String.Empty;
                // The Name of the Upload component is "files"
                if (files != null)
                    foreach (var file in files)
                        path = Path.Combine(Server.MapPath("~/Uploads"), chunkData.FileName);

                        AppendToFile(path, file.InputStream);

                FileResult fileBlob = new FileResult();
                fileBlob.uploaded = chunkData.TotalChunks - 1 <= chunkData.ChunkIndex;
                fileBlob.fileUid = chunkData.UploadUid;

                return Json(fileBlob);

    when the error file is in the last of the queue, other files are uploaded as expected. but if the error files come before the normal files the upload is in a kind of "paused" state. see the attached. 

    kindly let me know your insights. 

    If you can share your code with me, i can try the controller code you are using and see the difference. 




  4. Member12221
    Member12221 avatar
    5 posts
    Member since:
    Jul 2017

    Posted 19 Jul 2017 in reply to Member12221 Link to this post

    Hi Ivan, 

    I fixed the issue. turned out that we did not want the chunk upload. just an asynchronous upload did the trick. now I'm able to do all the validations without interfering with the other files. 

    Thanks heaps for your help and guidance. 

Back to Top