Added exception handling an also added env config for choice to upload files