Fixed image upload - database was being updated before images were processed.