HTC One M8 settings not allowing file transfer
One thing you can do is to use the HTC One M8 root toolkit, which allows you to fix most of the phone's problems with a click of a button. I am not very familiar with the HTC toolkit (I have a Nexus) but you should be able to factory reset your phone without wiping data from here.

You can use this method as a last resort if nothing else works. Here are some websites showing how to fix/backup the specific problem:

http://www.htc.com/us/support/htc-one-m8/howto/465027.html

http://deviceguides.vodafone.ie/web/htc-one-m8/change-settings/bluetooth/transfer-files-via-bluetooth

http://www.htc.com/us/support/htc-one-m8/howto/465041.html

If these don't work either, call HTC support since it may actually be a problem with the phone.