Extend FormResponseFilePathStrategy for MOVEit

DISCLAIMER: Out-of-the-box integration between Sitefinity and MOVEit for secure file transfer and storage is available as of Sitefinity CMS version 14.0.7724. The custom implementation described below is not supported in predecessor versions.

Overview

This article describes how to change the way file paths are generated for files that you transfer and store in MOVEit. The folder structure in MOVEit depends on the file path. By default, all files uploaded through a specific form are stored in the library for that form. This means that in MOVEit, they are located in a single folder. This makes it difficult to associate already uploaded file with a specific form response. If you want to have control on the folder structure of the uploaded files in MOVEit, you can implement custom FormResponseFilePathStrategy as described below.

Implement custom FormResponseFilePathStrategy

To extend FormResponseFilePathStrategy, you must register a class in the ObjectFactory that inherits from FormResponseFilePathStrategy.
You can override the following methods:

  • string GetRelativeFilePath(FormDescription form, FormEntry response, string originalFileName, string fileUploadFieldName, out string description)
    This method allows you to control the folder structure of the uploaded file. The returned path is a string of segments, separated by backslashes (/). The last segment in the path is the file name. To build the custom path, you can use data from the current context, such as current site or current language.
    The following parameters provide more specific context about the form submission:
    • form - (FormDescription) the metadata of the form
    • response - (FormEntry) the data from the other fields in the form response
    • originalFileName - (string) the original name of the uploaded file
      By default, it is used as the last segment in the path.
    • fileUploadFieldName - the name of the field through which the file is uploaded
      If you have more than one FileUpload fields in the form, the method will be executed for each of them with a different value of this parameter.
    • description - an output parameter that returns additional information about the uploaded file, besides the returned path
  • string GetLibraryName(FormDescription form)
    This method allows you to control the name of the library that is created for the specified form. It is called when a form with a FileUpload field is published for the first time. Unlike the GetRelativeFilePath method described above, this method does not use current context data, because it would not be relevant to the uploaded file.

Code sample

To extend FormResponseFilePathStrategy for your MOVEit integration, implement the following code in the Global.asax file of your project:

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?