wp_upload_bits()
allows you to put arbitrary binary data into a file, but it selects the path where the file is placed and doesn’t allow configuration of this destination besides the basename.
There’s always the option of playing with the Filesystem API directly, but I was wondering if there is a similar function to wp_upload_bits()
that would wrap the logic for me. Last thing I want is to reinvent the wheel.
It’s probably not relevant, but the bits being uploaded are being extracted from image/video metadata. A lot of the functionality is being reworked based on code from wp_generate_attachment_metadata()
.