Added a new function to deal with the upload.