Updated getFormData function to include filename