1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Mimic the Image & Document Upload Screen

Mimic the Image & Document Upload Screen

6 posts, 0 answered
  1. Scott Harrington
    Scott Harrington avatar
    28 posts
    Registered:
    21 Sep 2009
    23 Nov 2009
    Link to this post
    I need to do some custom logic with the Image & Document Upload screen but I don't want to touch the existing Upload code.  Rather, I'd like to mimic the current Upload screen then add my own logic.  I've tried to dissect the existing Upload screen but I just can't find the code to do so.  I can take care of the code behind with my custom logic, however, I just need a little direction on making the two UI's to look the same.  Thank you!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    23 Nov 2009
    Link to this post
    Hello Scott Harrington,

    You can map external template LibraryItemUpload.ascx .More information at How to map a view to an external template, in Sitefinity 3.6 or later?

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Scott Harrington
    Scott Harrington avatar
    28 posts
    Registered:
    21 Sep 2009
    23 Nov 2009
    Link to this post
    Ahhh, Very nice!  Thanks for the very nice reply, I've got it working.  Now, the next brain buster, I need to do a little custom work on the on click event of the upload.  However, I cannot find a single line of code behind that handles these uploads.  I see the upload button which is an actual Literal on the page with an ID="Literal24", but no click event attached to it.  Is there anyway I can get to the on Upload Click event code (Server-side) so I can do some extension checking prior to the file being uploaded.  Thanks a ton for your help!
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    23 Nov 2009
    Link to this post
    Hi Scott Harrington,

    There should be a RadUpload control with ID="filesUpload" which you have to access. Another option is subscribing for button click of the LinkButton control with ID="uploadButton"

    UploadButton.Command += new CommandEventHandler(Button_Command);

    Let me know if you get stuck somewhere.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  5. Scott Harrington
    Scott Harrington avatar
    28 posts
    Registered:
    21 Sep 2009
    23 Nov 2009
    Link to this post
    Still a bit confused...  Let me describe what I am trying to do, that might make this whole thing make more sense.  We've created our own video players that support WMV's and FLV's.  We've then created an encoder that will encode .mov, .mpeg, .avi, and a few more to a .wmv that renders at a bit rate and resolution that fits perfectly on our screen.  This encoder will be initiated via a web service, now here's the next piece of the puzzle.  The user has the ability to upload anything from .xls, to .png and any other type of file.  So when the user selects their files, they may select .mov and a .png, now I need to, on the upload, detect the file type and if it's a video type that our player supports, I need to send that file off to the web service for encoding.  The web service will take care of this file, but if the file is not supported by the player, .xls, .docx, among many others, the Sitefinity upload should handle this process as normal, and put them in the Sitefinity Library. 

    So in a nutshell, I need to get at the actual code-behind that handles the upload into the Sitefinfy Library, so I can check whether or not I need to continue with the normal Sitefinity upload, or send the file for encoding.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    23 Nov 2009
    Link to this post
    Hi Scott Harrington,

    There is no code behind of the LibraryItemUpload template. Everything is done through views which are embedded into Telerik.Libraries.dll. So here are two options - you can follow my suggestion from the previous replies by creating a code behind and subscribing for some events or the better option is createing a new view and replacing the base one. The button you see in the default view has ID="UploadButton" and you can easily subscribe for its click event. Below is shown a sample code.


    protected override void InitializeControls(Control viewContainer)
    {          
       UploadFiles();
    }
     
    private void UploadFiles()
    {
       UploadButton.CommandName = "Upload";
       UploadButton.Command += new CommandEventHandler(Button_Command);
       
    }
    private void Button_Command(object sender, CommandEventArgs e)
    {
     ILibrary library = LibManager.GetLibrary(SelectedLibraryID);
     
     if(e.CommandName == "Upload")
     {
     ProceedWithUpload(library);
     }
    }
     
     
       private void ProceedWithUpload(ILibrary library)
        {
       foreach (UploadedFile file in RAadUpload.UploadedFiles)
        {
        if(file.Contenttype == "video/mpeg")
         {
          // do something
         }
         else
        {
        //  do something else here
        }     
       }
        }  


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
6 posts, 0 answered