added security to upload image function