Extend FormResponseFilePathStrategy

IMPORTANT: As of version 14.0.7724, Sitefinity CMS provides built-in integration between Sitefinity and MOVEit for secure file transfer and storage. The custom implementation described below is not supported in predecessor versions.

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, which means that in MOVEit they will be available in a single folder. This makes it difficult to associate a file with a specific form response. In case 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

In order to extend FormResponseFilePathStrategy, you need to register a class in the ObjectFactory that inherits from FormResponseFilePathStrategy.
There are two methods to override:

  • string GetRelativeFilePath(FormDescription form, FormEntry response, string originalFileName, string fileUploadFieldName, out string description) - allows to control the folder structure of the uploaded file. The returned path should be a string of segments, which are separated by /. The last segment in the path is the file name. For building the custom path, data from the current context (like current site, current language) can be used. More specific context about the form submission is provided by the following parameters:
  • string GetLibraryName(FormDescription form) - allows to control the name of the library 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, here it does not make sense to use current context data, as it would not be relevant to the uploaded file.

Use the following code sample to extend FormResponseFilePathStrategy for your MOVEit integration scenario:

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?