working progress on the upload function