Kevin Warnke
Top achievements
Rank 1
Kevin Warnke
asked on 20 Mar 2009, 02:24 AM
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
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
6 Answers, 1 is accepted
0
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:
Best wishes,
Lini
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
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.
0
Kevin Warnke
Top achievements
Rank 1
answered on 25 Mar 2009, 02:54 PM
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
Thanks again,
Kevin
0
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.
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.
0
Kevin Warnke
Top achievements
Rank 1
answered on 16 Jul 2009, 07:56 PM
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
Any recommendations?
Thanks,
Kevin
0
Accepted
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.
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.
0
Kevin Warnke
Top achievements
Rank 1
answered on 17 Jul 2009, 08:50 PM
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
Thanks!!
Kevin