In PHP you can easily upload any type file on the server using the move_uploaded_file() method.
But it requires form submit for uploading the selected file.
If you want to store image file and display preview without reloading the whole page then you need to use jQuery AJAX.
Send the selected file using the FormData object in AJAX request.
#jquery_ajax #how_to_upload_image_using_jquery_ajax_php_and_mysql