code: function (attachment) {
                      // Define custom metadata properties for the file before saving
                      var customFileMetadata = {};
                      var parentItemId = model.getParentItemId();
                      if (parentItemId && parentItemId != '') customFileMetadata[scope.attachmentFilterFieldName + "Id"] = String(parentItemId);
  
                      // Upload the file using the SharePoint item service
                      return spFormFactory.uploadFileToDocLib(attachment.File.ArrayBuffer, scope.attachmentDocLibName, scope.attachmentDocFolderName, attachment.File.Name, attachment.File.Title, customFileMetadata);
                  }
docs: Upload the file. You can upload files up to 2 GB with the REST API.