Upload file text field .JPG and .PNG

Help! i’ve been told to make a text field for upload image, but the text field can only be in .JPG and .PNG?

can you help me explain how to make the text field image only be in .jpg or .png?