I have thousands of pictures in my iPhoto library. How do I transfer them to iCloud Drive?
I enable iCloud Photo Library and let the entire library be stored primarily in iCloud. That's far more useful for me than having the flat files backed up.

You could export them and store the exported files, but I use Time Machine or anther tool, (Carbon Copy Cloner and SuperDuper! are amazing. Are backup is nice for backing up to general cloud), if you need to back other things up too and not just the photo files.

You get lots of other benefits by enabling iCloud Photo library and exporting the library to flat files loses some of those benefits and features.