javascript to display and prepare data for upload