move uploading to database