RadAsyncUpload dropping a folder

4 posts, 0 answers
  1. Marko
    Marko avatar
    9 posts
    Member since:
    Mar 2012

    Posted 02 May 2012 Link to this post

    Hello,

    As I know it is not possible to upload the whole folder/directory using RadAsyncUpload control.
    However, when I drag and drop folder, it is accepted, but upload fails of course.

    Is there any way to cancel drop folder event?

    I tried something like this:
    function OnClientFileUploaded(sender, eventArgs) {
       if (eventArgs.get_fileInfo().ContentLength == 0 && eventArgs.get_fileInfo().ContentType == null) {
                    $("#" + "<%= hfRemoveFileIndex.ClientID %>").val(eventArgs.get_fileInfo().Index);
                    $("#" + "<%= btnRemoveFile.ClientID %>").click();          
                }
            }
    And on server side
    protected void btnRemoveFile_OnClick(object sender, EventArgs e)
    {
        int indexID = int.Parse(hfRemoveFileIndex.Value);
        RadAsyncUpload1.UploadedFiles.RemoveAt(indexID);
    }
    But then all uploaded files are lost, not just the problematic folder.

    Alternately I when process uploaded files I can ignore those where the ContentLength is 0, but this also makes problems when user wants to upload empty file.

    Thanks
    Marko
  2. Plamen
    Admin
    Plamen avatar
    2959 posts

    Posted 07 May 2012 Link to this post

    Hello Marko,

     
    You can refer the RadAsyncUpload validation demo and add a list of the AllowedFilesExtentions  for your specific scenario . This way the folders upload will be validated as well.

    Hope this will help you.

    Greetings,
    Plamen Zdravkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. Marko
    Marko avatar
    9 posts
    Member since:
    Mar 2012

    Posted 07 May 2012 Link to this post

    Hello,

    Thanks for the reply!
    Problem is that all file extensions are allowed, even file without an extension is OK, but no the folder/directory.
    I tried to put *, or *.* but it didn't help.

    Currently, I'm checking for extension and content length and this does the job, but has only one exception where it can make a problem. This is when file doesn't have an extension and is empty.

    I think that dropping a folder/directory should be automatically rejected as this is not working anyway?

    Thanks
    Marko
  4. Plamen
    Admin
    Plamen avatar
    2959 posts

    Posted 10 May 2012 Link to this post

    Hi Marko,

    In Drag and Drop functionality shown in our on-line demo we use the native HTML5 file Api and it seems that such validation is not implemented yet as it is mentioned in this forum thread. So it seems the this is a current limitation of our control. Please excuse us for this.

    Hope this will explain the issue. 

    Greetings,
    Plamen Zdravkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top