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

FileExplorer CreateNewDirectory problem

1 Answer 67 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Vladimir
Top achievements
Rank 1
Vladimir asked on 07 Jun 2011, 12:20 PM
Hi all.

I am having some issues with CreateNewDirectory. I wanted to create a Web Gallery using FileExplorer based on your demo. Because of using possible big files (4,5 MB and maybe more) I created a thumb directory and when uploading images I resize as well and them upload (resized and original) into 2 different directories (Images and ImagesThumb). In FileExplorer I show only the thumb directory. The DeletePath is defined to both Images and ImagesThumb directory. The images load OK and the memory usage is good. Deleting 2 directories at once or 2 files at once works great. But i have difficulties to create 2 directories.

The ASPX:
<telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Width="1000px" Height="690px"
                Skin="Black" EnableOpenFile="True" OnClientFolderChange="OnClientFolderChange"
                OnClientCreateNewFolder="onCreateNewDir"  OnClientLoad="OnFileExplorerLoad">               
 </telerik:RadFileExplorer>
 
CS:
string[] paths = new string[] { "~/ImagesThumb/", "~/Images/" };
RadFileExplorer1.Configuration.ViewPaths = new string[] { "~/ImagesThumb/" };
RadFileExplorer1.Configuration.UploadPaths = paths;
RadFileExplorer1.Configuration.DeletePaths = paths;

I have created the OnClientCreateNewFolder:
function onCreateNewDir(sender, eventArgs) {
    var oExplorer = getRadFileExplorer1();
    var dirPath = oExplorer.get_currentDirectory().replace('ImagesThumb', 'Images');
    oExplorer.remove_createNewFolder(onCreateNewDir);
    oExplorer.createNewDirectory(dirPath,eventAgs.get_newPath());
    oExplorer.add_createNewFolder(onCreateNewDir);
}

With no luck at all, in ImagesThumb it creates desired folder but in Images not. Then I tried create a second 
FileExplorer to handle the Image folder for me like this:

<telerik:RadFileExplorer runat="server" ID="RadFileExplorer2"Skin="Black" style="display:none">
<Configutation DeletePaths="~/Images" UploadPaths="~/Images" />               
            </telerik:RadFileExplorer>

OnCreate event:
function onCreateNewDir(sender, eventArgs) {
    var oExplorer = getRadFileExplorer1();
    var dirPath = oExplorer.get_currentDirectory().replace('ImagesThumb', 'Images');   
    getRadFileExplorer2().createNewDirectory(dirPath,eventAgs.get_newPath());   
}

Doesnt work either until the createNewDirectory has only 1 parameter and propmts a popup window to provide a name
but that is not desired. I dont want to use ActiveX object to create a directory.

Am I doing something wrong?? Is there a better way to achieve what I need???

Thx

1 Answer, 1 is accepted

Sort by
0
Accepted
Dobromir
Telerik team
answered on 07 Jun 2011, 05:08 PM
Hi Vitalij,

To achieve the required functionality I would recommend you to implement a custom content provider to RadFileExplorer and override StoreFile(), StoreBitmap(), DeleteFile(), CreateDirectory(), DeleteDirectory() methods in order to handle both directories simultaneously.

More information on how to implement custom content provider to RadFileExplorer is available in the following help article:
Using custom FileBrowserContentProvider

Greetings,
Dobromir
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
FileExplorer
Asked by
Vladimir
Top achievements
Rank 1
Answers by
Dobromir
Telerik team
Share this question
or