Extend FormResponseFilePathStrategy for MOVEit


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:

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?