added generic file upload, tweaked db insert