Wrote new unified upload code using SQL database.