RadFileExplorer upload issue and how to setup for use with multiple users?

2 posts, 0 answers
  1. Nimesh
    Nimesh avatar
    2 posts
    Member since:
    Dec 2010

    Posted 16 May 2011 Link to this post

    Having a issue with getting the RadFileExplorer work with the example provided in
    Following is the code used in my aspx file
    <telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Width="750px" Height="500px"
    <Configuration ViewPaths="~/Root/Default/ViewPath" UploadPaths="~/Root/Default/UploadPath"
       DeletePaths="~/Root/Default/DeletePath"  />
    </telerik:RadFileExplorer> I have the ViewPaths, UploadPaths and DeletePaths set up in my solution as in the attached file (fileupload.png). The table structure is modeled according to the Items table with the addition of column CreatedBy. Have the following record in the Items table ItemID:1 Name: Root ParentID: NULL MimeType: NULL IsDirectory: True Size: NULL Content: NULL upsize_ts: NULL CreatedBy: nmarker Question 1: With the above setup I am unable to upload documents, or create Directories. Check file screenshot2.png My requirement is every logged in user to my website will have their own file structure defined in the DB. Have modified DataServer.cs
     private DataTable Data
    ...                 SqlDataAdapter adapter = new SqlDataAdapter("SELECT ItemID, [Name], ParentID, MimeType, IsDirectory, [Size]FROM rbItems where CreatedBy='" + clsUtility.getLoggedInUserName() + "' ORDER BY ItemID", Connection);
    public byte[] GetContent(string path)
    ..         SqlCommand command = new SqlCommand("SELECT Content FROM rbItems WHERE ItemID = @ItemID AND CreatedBy = @CreatedBy", Connection);

        public void CreateItem(string name, string path, string mimeType, bool isDirectory, long size, byte[] content)
    ..         SqlCommand command =
                new SqlCommand(
                    "INSERT INTO rbItems ([Name], ParentId, MimeType, IsDirectory, [Size], Content, CreatedBy) VALUES (@Name, @ParentId, @MimeType, @IsDirectory, @Size, @Content, @CreatedBy)", Connection);
            command.Parameters.Add(new SqlParameter("@CreatedBy"clsUtility.getLoggedInUserName()));
    ...     }
    Question 2: Can all logged in users share the same physical folder structure? as in fileupload.png? or should each user have their own folder structure defined? Please advise.
  2. Pero
    Pero avatar
    1156 posts

    Posted 19 May 2011 Link to this post

    Hi Nimesh,

    Straight to your questions:

    1) I downloaded the project from the http://www.telerik.com/community/code-library/aspnet-ajax/file-explorer/connect-radfileexplorer-or-radeditor-to-a-sql-databse.aspx and modified it to resemble your scenario. Basically here is what I did:
    • Added another column to the Items table, of type nvarchar(50).
    • Modified the 3 methods you have modified.
    • For the UserName I use a static string
    However, everything worked as expected. No errors where thrown, and I could easily perform any action (like create new folders, upload and delete files) with the FileExplorer. You can find my sample project attached to the thread. Due to its large size, it was archived with rar compression and you can extract it using the free 7-Zip or the trial WinRar tool.
    Please make sure the SQL Queries return the correct data.
    One thing I noticed in the provided record is, you have NULL upsize_ts field, which does not allow nulls. Please make sure this field is always populated.

    2) Each user should have its own folder, because if two users use one and the same folder, one of the users might delete the files of the other and vice-versa.

    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.

Back to Top