added thumbnail preview and file upload functionality