integrated upload functionality provided by anne and balaji with some slight modifications so it works with sqlite