uploading files by using functions