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

Unable to delete file

5 Answers 146 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 13 Aug 2013, 07:57 AM
Hi,

i use FileExplorer, and i can't delete file.

Uploading file is ok
I test permissions with the function FullPermissionsTest, everything is ok.

    string physicalPathToTestFolder = System.IO.Path.Combine(testPhysicalPath, "");
                System.IO.DirectoryInfo testDir = System.IO.Directory.CreateDirectory(physicalPathToTestFolder);// Create folder
                testDir.GetDirectories();// List folders
                string testFilePath = System.IO.Path.Combine(testDir.FullName, "plpA034-C020540.jpg");// test file paths
                System.IO.File.Create(testFilePath).Close();// Create a file
                testDir.GetFiles("*.*");// List files
                System.IO.File.OpenRead(testFilePath).Close();// Open a file
  System.IO.File.Delete(testFilePath);// delete the test file


Notice that all paths are set at run time but initialpath is not set (because if i put a path (the same as viewpath eg) i ve got an error.
At design time : enableviewstate = true 

The message is : the selected file could not be deleted because the application did not have enough permissions...
im on Q2 2013 sp1

im stuck since 3 days... :/

please help 

ty


5 Answers, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 13 Aug 2013, 03:38 PM
Hi Marc,

I have already answered your support ticket on the subject, but for other user's convenience  I will paste my answer here as well:

Could you elaborate more on what exactly do you mean with "all paths are set at run time"? I could thing of some possible reasons causing a similar behavior:
  • the path to the problematic folder is not set as a value of the FileExplorer's DeletePaths property, so the control does not give you permissions to delete files in it
  • the Page_Load event is the latest moment of the page life-cycle where the FileExplorer's paths could be set and if you are doing it in a later event that may leads to many unexpected issues.
  • an error for "Non-existing folder" will be thrown if you are passing a virtual path to the InitialPath property. The value set to the InitialPath property is case sensitive and should be in the same format as shown in the RadFileExplorer's address bar (without "~" in front of it).

Please, give a try to the suggestions above and let me know how it goes.


Regards,
Veselina Raykova
Telerik
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 the blog feed now.
0
Marc
Top achievements
Rank 1
answered on 13 Aug 2013, 07:54 PM
Hello Veselina,

At runtime means to me , in code behind
         FileExplorer1.Configuration.SearchPatterns = new string[] { "*.*" };
                string[] dir = { Directories.getServerProdDocDirectory(true, this) + "/" + m_dir_codeart };
                FileExplorer1.Configuration.ViewPaths = dir;
                FileExplorer1.Configuration.UploadPaths = dir;
                FileExplorer1.Configuration.DeletePaths = dir;
                FileExplorer1.VisibleControls = GetVisibleControls();
                FileExplorer1.EnableOpenFile = true;
                FileExplorer1.DisplayUpFolderItem = true;
                FileExplorer1.AllowPaging = true;
                FileExplorer1.EnableCreateNewFolder = false;
                FileExplorer1.Configuration.MaxUploadFileSize = 750000;
                FileExplorer1.Configuration.AllowMultipleSelection = true;
                FileExplorer1.Configuration.EnableAsyncUpload = true;

Reason 1 is ok, see above
Reason 2 , this code is in page_load, so ok

Reason 3 : i dont understand what value i have to put in initial path.

Considering "dir" in my case is equal to : 
"~/docs_customers/interiors/docs_server/documents/prod//PS57"
And the absolute path to this folder is : 
"C:\dev\negosweb2\docs_customers\interiors\docs_server\documents\prod\\PS57"

what should be the value of initialpath ?

ty
0
Vessy
Telerik team
answered on 14 Aug 2013, 09:02 AM
Hi Marc,

Thank you for the clarifications.

The FileExplorer from the provided code-snippet seems to be configured properly and behaves well on my test page. Could you debug your application and see what is the exact value of the dir variable, is it the expected one?
string[] dir =  { Directories.getServerProdDocDirectory(true, this) + "/" + m_dir_codeart };

Regarding the InitialPath value - the easiest way to determine the correct path is to navigate to the desired folder through the FileExplorer and to copy the path to it, displayed into the FileExplorer's AddressBar - screenshot.

Additionally, I have noticed the there is a double path separator before the PS57 folder. Are you experiencing the same issues if you point to a folder with a standard path? (e.g. prod folder)

Regards,
Veselina Raykova
Telerik
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 the blog feed now.
0
Marc
Top achievements
Rank 1
answered on 14 Aug 2013, 01:43 PM
Hi Veselina,

You've found the problem

it was the double slash //

thx to you

Marc
0
Vessy
Telerik team
answered on 14 Aug 2013, 01:54 PM
Hi Marc,

I am glad I was helpful in solving the case. Feel free to contact us whenever we could be of any further assistance.

Regards,
Veselina Raykova
Telerik
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 the blog feed now.
Tags
FileExplorer
Asked by
Marc
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Marc
Top achievements
Rank 1
Share this question
or