How to upload the 4k videos taken to YouTube? iPhone 7 Plus can take 4k videos, but if you click on the Photos app and upload to YouTube, for some reason it is limited to 240p. If you click on the YouTube app and upload, then it is 1080p.

Is there a way to upload directly from iPhone to YouTube in 4k resolution?

I think one way that will work is to transfer the video to the computer first, and then transfer from the computer to YouTube, but is there a way to directly do it on the iPhone, I wonder.
This is a limitation of Apple's Photos.app as of iOS 10.3.1.
Photos.app limits video uploads to 720p/1080p.
To upload 4K videos from your iPhone to YouTube you can use Apple's iMovie for iOS. iMovie for iOS is free for all users since April 18 2017.
Unfortunately you have to use a second app to accomplish a 4K upload.