really hacky code for uploading files