More in this section

Forums / Developing with Sitefinity / Circumventing the RadUploadHttpModule

Circumventing the RadUploadHttpModule

6 posts, 0 answered
  1. Jeff
    Jeff avatar
    27 posts
    Registered:
    18 Jun 2008
    08 Jul 2008
    Link to this post
    Hello!

    We've recently been instructed by our network administrators that as files get uploaded to our site through Sitefinity that same file must be sent via FTP over SSL to another server within our network.

    I've found that Sitefinity uses a module to handle uploading files through the RAD controls (I was looking at the ~/Sitefinity/Admin/File.aspx page) however from what I've seen there is no way to determine which files were being uploaded through the file manager.

    Is there any way to get at the list of files that a user uploaded without interrupting anything Sitefinity needs to operate correctly? I was looking at creating proxy classes for the internal classes used by Sitefinity using reflection, however that's more of an absolute last resort that I would prefer to not have to do.

    Any help would be greatly appreciated!
  2. Joe
    Joe avatar
    138 posts
    Registered:
    24 Sep 2012
    09 Jul 2008
    Link to this post
    Hi Jeff,

    Thanks for contacting us with your technical question.

    Using the RadUpload tool's API, you can tell which files have been uploaded. You could bind a repeater control to the file name property as this code will show you:

    <asp:repeater id="repeaterValidResults" runat="server" visible="False"
                                    <headertemplate> 
                                        Uploaded valid files:<br /><br /> 
                                    </headertemplate> 
                                    <itemtemplate> 
                                        <%#DataBinder.Eval(Container.DataItem, "FileName")%> 
                                         
                                        ( 
                                        <%#DataBinder.Eval(Container.DataItem, "ContentLength").ToString() + " bytes"%> 
                                         )<br /><br /> 
                                    </itemtemplate> 
                                </asp:repeater> 


    For more info, take a look at this online demo of the RadUpload. This article on the Uploaded Files property should also give you guidance on retrieving file names. I hope that my instructions for getting file names provides a solution for your implementation. If you have any questions, please let us know.

    Kind regards,

    Joe
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Jeff
    Jeff avatar
    27 posts
    Registered:
    18 Jun 2008
    09 Jul 2008
    Link to this post
    This seems fine and all, however this is going to force me to make changes to Sitefinity directly. Which if we apply a patch or service pack to Sitefinity we'll have lost the changes we made to it. If we were the developers of the original site this would have been a good solution, but as it stands physically modifying the code that resides within the Sitefinity folder really shouldn't be an option.

    That's why I was looking at replacing the RadUploadHttpModule, it wouldn't actually harm Sitefinity at all and allow us to do whatever else we wanted to with the files that were being uploaded. The problem is a lot of the code I need access to is all internal in the Sitefinity assemblies for some reason.
  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    11 Jul 2008
    Link to this post
    Hello Jeff,

    Actually, we define the httpModule in the web.config file:
    <httpModules> 
      .. 
       <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule, Telerik.Web.UI" /> 
    </httpModules> 

    You can extend this httpModule or create a new one and add it to the file.
    You can find more about the httpModules in MSDN.

    I hope that I was able to help.

    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Jeff
    Jeff avatar
    27 posts
    Registered:
    18 Jun 2008
    11 Jul 2008
    Link to this post
    The first thing I tried was to extend the class.

    My problem with it was everything I needed from the class was either private or internal. Unless I rewrote a lot of the code used to parse the files out of the request stream (that's being done in your Telerik.Web.UI.Upload.RequestParser class I have no way of accessing the names of the files that were uploaded. Thus bringing me back to the original problem. If anything within Sitefinity changed during a patch that affected how the files were being uploaded, I would have to go over the code I had to rewrite in order to find where the differences were at.

    Seems like it'd be easier if this was just made an extensibility point. The classes used to handle file uploading were made externally visible and unsealed (where applicable).

    From what I've seen so far there isn't much chance I'd be able to do it without wrapping the private objects and using reflection to invoke the members I needed, which is going to be quite a bit of headache based on how many objects/methods are used to handle uploading files.
  6. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    15 Jul 2008
    Link to this post
    Hello Jeff,

    I see your point now, and agree that you are right. You should probably go with Joseph's suggestion in this case.
    I want to assure you that your comments have reached our RadControls team and we are constantly trying improve our tools.

    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
6 posts, 0 answered