File in variable File

Hello, does anyone know how I can store a file in a variable of type File? The file is loaded by code, I have its path.