I'm looking for a way of not just selecting files for upload but entire folder structures. I was hoping I could use the CreateOpenFileDialog delegate to return the RadOpenFolderDialog however this function expects a return type of Microsoft.Win32.OpenFileDialog which the Telerik controls do not inherit from.
Any suggestions?
6 Answers, 1 is accepted
You are right. The CreateOpenFileDialog delegate returns an object of type OpenFileDialog which is not the base class of the RadFileDialog controls.
To achieve your requirement you can hide the default Browse button via the Buttons property of RadCloudUpload, and then add a new button over the control. When you click the new button you can open a new folder dialog and when you choose a folder you can get its file names and add them in the cloud upload programmatically.
I hope that helps.
Regards,
Martin Ivanov
Progress Telerik

Thanks for your response. Since posting I have actually solved the problem by implementing drag and drop from Windows Explorer which, as you suggest, programmatically adds the files to the upload control. I had to do some interesting things in order to retain folder structure though as the default implementation only takes the filename when calling the upload provider!
public
interface
IDocumentTransferProvider : ICloudUploadProvider
{
string
DestinationPath {
get
;
set
; }
IDocumentDirectory Destination {
get
;
set
; }
}
public
class
DocumentTransferProvider : IDocumentTransferProvider
{
public
string
DestinationPath {
get
;
set
; }
public
IDocumentDirectory Destination {
get
;
set
; }
public
Task<
object
> UploadFileAsync(
string
fileName, Stream fileStream, CloudUploadFileProgressChanged uploadProgressChanged, CancellationToken cancellationToken)
{
if
(!
string
.IsNullOrEmpty(DestinationPath))
fileName = $
"{DestinationPath}/{fileName}"
;
return
Destination.CopyTo(fileStream, fileName,
new
DocumentTransferProgressHandler(uploadProgressChanged), cancellationToken)
.ContinueWith<
object
>(t =>
{
if
(t.Exception !=
null
)
Logger.Exception(t.Exception);
return
t.IsCompleted;
});
}
}
It is nice to hear that you've found a solution for your case. Thank you for sharing your code.
Regards,
Martin Ivanov
Progress Telerik

Hi,
I've just encountered another issue with the Cloud Upload control. It seems that if I use the "Cancel" button mid transfer I am getting a state transition from "Cancelling" to "Uploaded". Surely it should end up on the "Cancelled" state?
I've tested this but I wasn't able to reproduce it. Can you take a look at the attached project and let me know if I am missing anything?
Regards,
Martin Ivanov
Progress Telerik
