Unable to delete file

6 posts, 0 answers
  1. Marc
    Marc avatar
    3 posts
    Member since:
    Mar 2013

    Posted 13 Aug 2013 Link to this post

    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


  2. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 13 Aug 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Marc
    Marc avatar
    3 posts
    Member since:
    Mar 2013

    Posted 13 Aug 2013 Link to this post

    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
  5. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 14 Aug 2013 Link to this post

    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.
  6. Marc
    Marc avatar
    3 posts
    Member since:
    Mar 2013

    Posted 14 Aug 2013 Link to this post

    Hi Veselina,

    You've found the problem

    it was the double slash //

    thx to you

    Marc
  7. Vessy
    Admin
    Vessy avatar
    1389 posts

    Posted 14 Aug 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017