Various improvements for easier handling of file upload from forms, fixes #327