I created an IAS that uses the FileSelector class. I want to use the Upload button that contains that class to trigger the import action but I checked in the documentation and didn't find a listener/action for that class. Is there a way to do that (reuse the upload button to execute the import action)? Using another button won't be useful for user interaction as the Upload button is a bit confusing.
Hi German,
I'm not sure if the FileSelector component supports 'WantsOnChange', but if it does, the following class that extends FileSelector might work. The 'FilesUploaded' event should be fired after the user has uploaded a file.
public class FileSelectorWithEvent : FileSelector
{
public FileSelectorWithEvent()
{
BlockDefinition.WantsOnChange = true;
}public event EventHandler<EventArgs> FilesUploaded;
protected override void LoadResult(UIResults uiResults)
{
base.LoadResult(uiResults);if (UploadedFilePaths.Any())
{
FilesUploaded?.Invoke(this, EventArgs.Empty);
}
}
}
FileSelector does not support actions. For now, we are using another button to execute the import action.
Hi German,
Were you able to use the solution Tom proposed? If yes, could you select his answer to indicate that this question has been solved? If no, have you found a different solution in the meantime?