Related: How to use data uploaded through a FileInput widget in a param.Parameterized class and handle situation where no data has been uploaded yet?
This topic discussed the same problem, but for classes.