Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
How to move a file after upload under .NET core

version 2016.2

Using the igUpload control, is it possible to move the file to another folder after the upload is completed under .NET core?

Is there a way to tie in to a server side event related to the "controlId" within the controller?

  • 17150
    Offline posted

    Hello Stephen,

    Thank you for posting in our community.

    igUpload control allows you to manipulate(delete, move, copy etc.) uploaded files. This can be achieved by handling UploadFinishing server side event. In this event the file is uploaded in a temporary folder (set in the web.config file) where all files are saved while uploading. Initally the file has a unique name (that is generated from Upload HttpModule) which is afterwards changed to files original name (if there is a file with a duplicate name it will be overwritten). To achieve your requirement you can cancel this event and move the file to the folder of your choice. Some further reference about using server side events of igUpload can be found online:

    In regards to your second question I will need some additional information. By design when registering an event in the Global.asax file, you add the control`s id as a parameter which means that this particular handler is tightly coupled with a particular controls event. For example if you have the following code in the Global.asax:

        new EventHandler<FileUploadingEventArgs>(Controllers.HomeController.igUpload_FileUploading));

    This will mean that igUpload_FileUploading event is going to be triggered only for "upload1" control.

    Please let me know if you need any further assistance with this matter.

Reply Children
No Data