Set File Attribute during Upload using FileExplorer

5 posts, 0 answers
  1. Leo Baumer
    Leo Baumer avatar
    1 posts
    Member since:
    Nov 2008

    Posted 13 Aug 2010 Link to this post

    Hello,

    I would like some direction or code samples in how to set file attributes during file uploads using FileExplorer. I was able to display the file Created Date and Owner Name attributes in the grid using the examples on this site, however, my requirement is to display the name of the user who uploaded the file (the Owner Name is always BUILTIN/Administrators).

    Regards,
    Leo
  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 18 Aug 2010 Link to this post

    Hi Leo,

    I have already answered your support ticket. For convenience I have pasted a part of my answer here:
    "In general I recommend you to use this method:
    • Inherit the Telerik Telerik.Web.UI.Widgets.FileSystemContentProvider class (or build a completely new provider) and override its StoreFile method.
    • Set the new content provider to the RadFileExplorer:
      RadFileExplorer1.Configuration.ContentProviderTypeName = typeof(CustomProvider).AssemblyQualifiedName;
    • Implement the StoreFile method in order to save the file (this method should return the virtual path to the stored file).
    • Inside the StoreFile method, get the reference to the page object, which hosts the RadFileExplorer control using this approach.
    • Get the user name of the logged user:
      string userName = _page.User.Identity.Name
    • Please note that you need to implement a custom logic here which will associate the saved file with the user which uploads the file. This can be done in many ways (for example, storing the files in a database and adding a column, which contains the username)
    "

    Greetings,
    Fiko
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Aaron C
    Aaron C avatar
    23 posts
    Member since:
    Sep 2009

    Posted 18 Aug 2010 Link to this post

    Hi Fiko,

    I am trying to do something similar, and I have my Custom provider built, and I have an override method for StoreFile.  However when I debug StoreFile does not get called when I upload a file, GetFile is called first.  I must be misunderstanding something, because the file has not yet been uploaded and there is no way to get it.  Your response to Leo was very helpful, could you please explain what needs to be done in general to upload a file using a custom provider? 
  5. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 24 Aug 2010 Link to this post

    Hi Aaron,

    The RadFileExplorer control calls the GetFile method in order to determine whether a file exists or not. If the  method returns null (Nothing in VB.NET), then the StoreFile method will be called. Please note that store method will be called even when the GetFile returns an object (not null) if the Override checkbox is checked in the upload dialog.

    I hope this helps.

    Regards,
    Fiko
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Aaron C
    Aaron C avatar
    23 posts
    Member since:
    Sep 2009

    Posted 24 Aug 2010 Link to this post

    Thanks Fiko, that makes sense. 
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017