Associate uploaded files with a user

2 posts, 0 answers
  1. Sunil
    Sunil avatar
    224 posts
    Member since:
    Jan 2004

    Posted 26 Aug 2012 Link to this post

    Suppose, I want to associate each uploaded file with the user who has uploaded it, then how would I do this in RadEditor? I only have a single path for upload, view and delete of uploaded files for all RadEditor managers. This path is '~/RadEditor/UploadedFiles'. There could be 100 or 500 or 1,000 or 10,000 users on my website.
    This would mean that when a user opens an image manager or document manager or flash manager or media manager from RadEditor, then he/she would only see files uploaded by him/her.

  2. Rumen
    Rumen avatar
    12782 posts

    Posted 27 Aug 2012 Link to this post


    It is standard practice to have your users' IDs stored in a database of your CMS, and create a specific folder for each user when a user account is created. Then, when a user is logged and wishes to use the editor, setting the user's folder for this particular logged user is a matter of a single line of code, such as

    RadEditor1.ImageManager.ViewPaths = New String() {"~/RadEditor/UploadedFiles/" + LOGGEDUSERID}

    Thus each user will have access only to his/her folder and be able to do whatever you let them do, without interfering with other users (and yes, if you have 100 users you will need to create 100 folders).

    Another approach is to create a custom content provider that will filters the uploaded files according to the logged user. You can use as a base the provider available in the following live demo: Filter files and download.

    Kind regards,
    the Telerik team
    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 their blog feed now.
  3. DevCraft R3 2016 release webinar banner
Back to Top