upload event

7 posts, 1 answers
  1. Kevin Warnke
    Kevin Warnke avatar
    98 posts
    Member since:
    Dec 2005

    Posted 19 Mar 2009 Link to this post

    I want to easily keep track of how much space users are consuming when the upload files through the editor and the file explorer.

    I found out what events to monitor for the Editor to determine when a file is uploaded or deleted.

    I found out what event to monitor for the File Explorer when items are deleted.  The ItemCommand event seems to fire for almost everything EXCEPT for when a file is uploaded.

    Question: what event can I monitor to know when a file is uploaded via File Explorer?

    I'd prefer not to write a custom provider although I may have to if I can't solve this one.

    Thanks,
    Kevin
  2. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 25 Mar 2009 Link to this post

    Hello Kevin,

    The file upload event will be available in next week's RadControls Q1 2009 service pack release. You will need to add a handler for the FileExplorer's ItemCommand server event and check if the command name is equal to "UploadFile". For example:

    protected void RadFileExplorer1_ItemCommand(object sender, Telerik.Web.UI.RadFileExplorerEventArgs e) 
        if (e.Command == "UploadFile"
        { 
            //to cancel the event set e.Cancel = true; 
        } 
     



    Best wishes,
    Lini
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  3. Kevin Warnke
    Kevin Warnke avatar
    98 posts
    Member since:
    Dec 2005

    Posted 25 Mar 2009 Link to this post

    That sounds good.  Is there any chance that a fix for files showing up in FireFox will be included in this SP?  I think this question was asked on another thread.

    Thanks again,
    Kevin
  4. Tervel
    Admin
    Tervel avatar
    1337 posts

    Posted 30 Mar 2009 Link to this post

    Hi Kevin,

    We are researching the FireFox files issue, and once more information on the problem becomes available we will post an answer to that forum thread.

    Best regards,
    Tervel
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
  5. Kevin Warnke
    Kevin Warnke avatar
    98 posts
    Member since:
    Dec 2005

    Posted 16 Jul 2009 Link to this post

    I just tried using the UploadFile command but the problem is this event is fired BEFORE the file system activity takes place.  So I can't check the FileInfo for the file to see its size.

    Any recommendations?

    Thanks,
    Kevin
  6. Answer
    Lini
    Admin
    Lini avatar
    2144 posts

    Posted 17 Jul 2009 Link to this post

    Hi Kevin,

    You are correct - the ItemCommand server event will give you only the item's path. I think that there are two possible workarounds for your scenario - you can save the path in the ItemCommand event and then wait for the file to be stored and later in the page life cycle (e.g. in the PreRender event) use the file path to access the stored file and check its size. The other workaround requires a bit more code but it is cleaner because you intercept the save operation and check the size there. You need to customize the default content provider for the file explorer (http://www.telerik.com/help/aspnet-ajax/radfileexplorer-custom-filebrowsercontentprovider.html) and override the StoreFile() method. In this method you will have full access to the uploaded file and can decide whether to proceed with the save or discard it.

    Greetings,
    Lini
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  7. Kevin Warnke
    Kevin Warnke avatar
    98 posts
    Member since:
    Dec 2005

    Posted 17 Jul 2009 Link to this post

    Thanks for the tips.  For now I'll just use the PreRender event because what I'm doing is very simple and I don't need (well, want really) to overcomplicate it with a provider extension.

    Thanks!!
    Kevin
Back to Top