Assuming I have an array of file handles created using PHP's tmpfile() function, can I send the files as attachments using PHP curl?
Ordinarily, I'd make an associative array in the form $postdata[fieldname] = '@path_to_file', but since I can't determine the path of the tmpfile (I only have the handle), I'm at a loss.
Motivation: I don't want to have to separately purge the contents of these tmpfiles from disk. I feel the tmpfile behavior suits this purpose but the curl component is complicating things.
Post-Answer Consideration: Jay's answer clears this up, but I came across a deal-breaker shortcoming of tmpfile: the "clean-up" behavior is skipped in the event of a FATAL or abrupt termination of the process, so manual purging would be necessary as a fail-safe. I don't think there's any way to circumvent the process of going through the filesystem and ensuring everything is cleaned up, tmpfile or not.