This is a migrated thread and some comments may be shown as answers.
Not able to upload and delete files
11 Answers 419 Views
This is a migrated thread and some comments may be shown as answers.
Roland Vonk
Top achievements
Rank 1
Roland Vonk asked on 23 Apr 2009, 02:09 PM

Hi there,

I’m having troubles getting RadFileExplorer to work. Listing files works fine, and viewing also, but uploading and deleting doesn’t work at all.

 

If I try to delete a file, I first get an error in Visual Studio in a script file loaded from a web resource (Telerik.Web.Resource.WebResource_2.axd), in _callWebService:function(_13,_14,_15), on line 29:

if(this._folderCache[_1e]!=null&&!_14){

The error is ‘Microsoft JScript runtime error: 'this._folderCache' is null or not an object’. If I continue, I get the following response: The selected file could not be deleted because the application did not have enough permissions. Please, contact the administrator.

 

I’m running it from Visual Studio, using the Development Web Server, and I have Full Control rights in the directory I want to delete a file from. I also tried running Visual Studio as Administrator, which made no difference. After the error, my upload button also mysteriously disappears.

 

If I try to upload a file, I get no error in Visual Studio, but I get the following response in my page: E:ErikDownloadstest.jpeg : Cannot write to the target folder!

 

My RadFileExplorer is declared as follows:

 

<telerik:RadFileExplorer runat="server" ID="FileExplorer" DisplayUpFolderItem="False" Skin="Office2007" VisibleControls="Grid, Toolbar, ContextMenus">

       <Configuration SearchPatterns="*.jpg,*.png,*.gif,*.css,*.htc,*.jpeg,*.bmp" />

</telerik:RadFileExplorer>

 

In code-behind, the only interaction with the control is setting the ViewPaths, DeletePaths and UploadPaths, all set to the same single path, formatted as a virtual path, ending in a forward slash.

 

My page uses a RadScriptManager and contains an UpdatePanel, but that doesn’t seem to be the issue; the FileExplorer causes errors whether I have the UpdatePanel on the page or not.

I'm running the latest build.
Hope somebody has some suggestions.

Thanks, Roland

11 Answers, 1 is accepted

Sort by
0
ManniAT
Top achievements
Rank 2
answered on 23 Apr 2009, 03:31 PM
Hi,

about your paths - did you set it somehow like this:
ViewPaths="~/XFiles,~/XImages,~/XDocs" 
I use this setting - and it works without problems.

Maybe you want to take a look at my sample here:
http://www.telerik.com/community/code-library/aspnet-ajax/file-explorer/extending-the-radfileexplorer.aspx

It does a bit more - but I guess it can point you in the right direction.

But anyhow - this "E:ErkicDownloa..." makes me think that you made a mistake in path definition.
Could you post your code setting the paths please?
Or set them (if possible) in ASPX instead of doing this in code behind.

Regards

Manfred
0
Fiko
Telerik team
answered on 28 Apr 2009, 07:58 AM
Hello Roland,

I used your code and prepared a test project, but I was not able to reproduce the error on my side. It looks like the issue is related to the paths that you set in the codebehind.
Please note that, by design, the  RadFileExplorer control works only with virtual paths. That being said the folders should be in your application's root folder. In case if you need to use folders that are out of the application, you need to use a custom FileBrowserContentProvider as showed in this online demo.
For your convenience I have attached my demo to this thread. Could you please check it and let me know if it helps?
In case that you still experience the problem, please modify the project, open a new support ticket and send it back. Once we have a better view over your exact setup we will do our best to provide a solution. 


Greetings,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Roland Vonk
Top achievements
Rank 1
answered on 29 Apr 2009, 02:32 PM
Hi,

Thanks for your suggestions.

The problemwas caused by not properly setting the paths. They were in the correct format,but they were only set (in code-behind) on non-postback requests. A suggestionto Telerik might be to validate that all paths are set when an event occurs andthrowing an appropriate exception if they are not; the error I got was veryconfusing.

Greetings,

Roland

0
Lini
Telerik team
answered on 30 Apr 2009, 06:15 AM
Hi Roland,

By any chance, have you disabled the RadFileExplorer's ViewState? If you have, please turn it back on and you shouldn't have to set the configuration paths after postback.

The ViewState is disabled in the FileExplorer's default example, because it allows us to showcase the VisibleControls property. There is no need to disable it in a normal scenario. We will fix the default example for the next release so people that use it as a base will not get confusing errors when trying to upload files.

Sincerely yours,
Lini
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Eric Krauska
Top achievements
Rank 1
answered on 11 Jul 2009, 08:09 PM
I am getting a very similar issue with the latest version of FileExplorer.  I have to set the paths on each postback in order to be able to upload, delete, or create folder.  Additionally, I have to set the Configuration.SearchPatterns every time as well.  ViewState is true.  Very odd behavior indeed:

        protected void Page_Load(object sender, EventArgs e)  
        {  
            _fileExplorer.Configuration.SearchPatterns = FileExtensions.GetValidExtensions(Server.MapPath("~/projects"));  
 
            //if (!IsPostBack)  
            //{  
                string[] path = { "~/projects/" + Request["ID"]};  
                _fileExplorer.InitialPath = path[0];  
                _fileExplorer.Configuration.ViewPaths = path;  
                _fileExplorer.Configuration.UploadPaths = path;  
                _fileExplorer.Configuration.DeletePaths = path;  
                _fileExplorer_fileExplorer.Upload.AllowedFileExtensions = _fileExplorer.Configuration.SearchPatterns;  
                _fileExplorer.Upload.InitialFileInputsCount = 2;  
                _fileExplorer.Upload.RegisterWithScriptManager = true;  
            //}  
        } 

<asp:Content ID="Content2" ContentPlaceHolderID="_body" runat="server">  
    <telerik:RadFileExplorer ID="_fileExplorer" runat="server"   
    EnableCreateNewFolder="true" EnableOpenFile="False" Skin="Vista">  
    <Configuration MaxUploadFileSize="204800000" /> 
    </telerik:RadFileExplorer> 
 
 
 
 
</asp:Content> 
0
Lini
Telerik team
answered on 13 Jul 2009, 03:38 PM
Hello,

We have fixed a problem with loading the file explorer configuration from the ViewState. The fix will be included in the next service pack release and the next internal build (check the release notes). I hope that it will address the problem you are having as well.

All the best,
Lini
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Dédé
Top achievements
Rank 1
answered on 15 Jul 2009, 01:55 PM
Hi,

I have a behavior like this : can't delete files, but I can upload files. I am using 2009 Q2.
I have coded my own FileBrowserContentProvider and all worked fine in 2009 Q1.

I will check using internal builds.
0
Suneco
Top achievements
Rank 2
answered on 16 Jul 2009, 02:22 PM
I have the same problem. I can't delete/upload files afther i updated Telerik from Q1 to Q2

Update:
I think i have the solution for the problem. You must set the Configuration.DeletePaths property on the FileExplorer.
0
Kyle Banashek
Top achievements
Rank 1
answered on 10 Jan 2010, 02:12 AM
Yo Fiko-

Where's the demo you were going to attach?

This control needs some work or additional documentation...lots of caveats using this thing.

I'm unable to get the delete/create/upload functions working when assigning paths at runtime. Assigned declaratively they work fine but that will not work for my solution. Please help me out here with this.

  protected void Page_Load(object sender, EventArgs e)
        {
            
            if (Session["OrgID"] != null)
            {
                orgID = Session["OrgID"].ToString();
                
                _targetFolder = Server.MapPath("~/Docs/" );



                RadFileExplorer1.TreeView.Nodes.Clear();

                RadFileExplorer1.InitialPath = "/Webmail/Docs/" + orgID;

                var s = new string[1];
                s[0] = RadFileExplorer1.InitialPath;

                RadFileExplorer1.EnableCreateNewFolder = true;
                RadFileExplorer1.Configuration.ViewPaths = s;
                RadFileExplorer1.Configuration.UploadPaths = s;
                RadFileExplorer1.Configuration.DeletePaths = s;
                RadFileExplorer1.Upload.InitialFileInputsCount = 2;
                RadFileExplorer1.Upload.RegisterWithScriptManager = true; 


  <telerik:RadFileExplorer ID="RadFileExplorer1" 
                                                                            EnableCopy="true" 
                                                                         
                                                                            EnableViewState="true"
                                                                            EnableCreateNewFolder="true"
                                                                            EnableOpenFile="true" 
                                                                          
                                                                            
                                                                            runat="server">
                                                                            <Configuration  MaxUploadFileSize="20"  />
                                                                            
                                                                        </telerik:RadFileExplorer>
              
0
Fiko
Telerik team
answered on 13 Jan 2010, 01:03 PM
Hi Kyle Banashek,

For some reasons the attachment did not make it through. In your case, however, the problem is different and it is related to a problem in the recent version (2009.3 1208) of the RadFileExplorer control. The unexpected behavior that you experience appears when the InitialPath property of the control is set before the ViewPaths, DeletePaths and UploadPaths ones.  You can avoid the issue by moving the IitialPath assignment at the end of the code.

Your code should looks like this:
protected void Page_Load(object sender, EventArgs e)
        
            if (Session["OrgID"] != null)
            {
                orgID = Session["OrgID"].ToString();
                _targetFolder = Server.MapPath("~/Docs/" );
                RadFileExplorer1.TreeView.Nodes.Clear();
 
                var s = new string[1];
                s[0] = RadFileExplorer1.InitialPath;
 
                RadFileExplorer1.EnableCreateNewFolder = true;
                RadFileExplorer1.Configuration.ViewPaths = s;
                RadFileExplorer1.Configuration.UploadPaths = s;
                RadFileExplorer1.Configuration.DeletePaths = s;
                RadFileExplorer1.Upload.InitialFileInputsCount = 2;
                RadFileExplorer1.Upload.RegisterWithScriptManager = true;
                RadFileExplorer1.InitialPath = "/Webmail/Docs/" + orgID;
}

In case that you still experience the problem, please open a new support ticket and send me a runnable project that reproduces the problem and I will do my best to provide a solution as soon as possible.
 
I hope this helps.

Regards,
Fiko
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Kyle Banashek
Top achievements
Rank 1
answered on 13 Jan 2010, 02:22 PM
That worked! 

Thanks so much for getting back to me on this.

Cheers
Kyle
Asked by
Roland Vonk
Top achievements
Rank 1
Answers by
ManniAT
Top achievements
Rank 2
Fiko
Telerik team
Roland Vonk
Top achievements
Rank 1
Lini
Telerik team
Eric Krauska
Top achievements
Rank 1
Dédé
Top achievements
Rank 1
Suneco
Top achievements
Rank 2
Kyle Banashek
Top achievements
Rank 1
Share this question
or