You need a JavaAction for that (see this). Create one with two parameters: filedocument and directory. Make the directory an attribute of the workgroup. Create an option 'Automatically save the file to a directory'. After the document is committed, check whether this option is true, if so, call the javaaction, if no call the download action.