refactor a bit to take werkzeug.datastructures.FileStorage objects instead of plain files, require media_root to be set, avoid errors at import of field