Adding function to handle uploads