Added validation to prevent uploading of files with size > 500KB and
non-image files.