How to capture the upload event in Insert Image dialog

Last post 06-18-2013, 5:00 PM by oddball. 2 replies.
Sort Posts: Previous Next
  •  06-18-2013, 1:08 PM 77577

    How to capture the upload event in Insert Image dialog

    I am using the InsertImage dialog to manage the images in my application. I need to capture the upload, run my own image handling routines and store its path in a database.

    Is there a way to capture this like you can with the standard Uploader control on the VS 2012 toolbox?

  •  06-18-2013, 1:35 PM 77578 in reply to 77577

    Re: How to capture the upload event in Insert Image dialog

    Hi oddball,

     

    The upload control in the insert image dialog has a "FileUploaded" event, you can add your own logic there. 

     

    1. Open fileCuteSoft_Client\CuteEditor\Dialogs\InsertImage.aspx, add the code below into the page OnInit event.

     

      InputFile.FileUploaded += new UploaderEventHandler(InputFile_FileUploaded); 

     

    2. Add the method below into the "InsertImage.aspx", it will fire after uploaded.

     

      void InputFile_FileUploaded(object sender, UploaderEventArgs args)
        {
            //save upload file to a new location
            //args.CopyTo("~/myfolder/"+args.FileName);
        }
     

    But note that, this event will not disable the default upload behavior, it is an addition option to add your own logic.

     

    Another way is add a new upload control there and hide the default one, then the new upload control has nothing default behavior, you can use any logic you need for it.

     

    <ce:uploader id="myUpload" runat="server" ></ce:uploader> 

     

    Regards,

     

    Ken 

     

     

  •  06-18-2013, 5:00 PM 77580 in reply to 77578

    Re: How to capture the upload event in Insert Image dialog

    Thanks, that is what I'm looking for.
View as RSS news feed in XML