This is a migrated thread and some comments may be shown as answers.

RadAsyncUpload dropping a folder

3 Answers 108 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Marko
Top achievements
Rank 1
Marko asked on 02 May 2012, 10:37 AM
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

3 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 07 May 2012, 09:39 AM
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.
0
Marko
Top achievements
Rank 1
answered on 07 May 2012, 09:49 AM
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
0
Plamen
Telerik team
answered on 10 May 2012, 09:40 AM
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.
Tags
AsyncUpload
Asked by
Marko
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Marko
Top achievements
Rank 1
Share this question
or