xml - How to transfer contents of a string, not a file, directly to client via http download in Drupal? -
i'm getting stuck while developing form in drupal; upon valid submission, want form initiate http file transfer client, opening file download prompt data generated in-memory string, not file. file_transfer($source, $headers) looked quite promising, $source expected uri file. there similar function accepts contents of string instead of file uri? in search through drupal api documentation, have yet find anything. i have tried (hackish) more manual approach: header("header statements"); header("more header statements"); echo $string_contents; exit; this method of course, interrupts drupal's form processing, can't lead things in long term. any appreciated. thanks! something along these lines: <?php header("content-type: application/octet-stream"); header("content-disposition: attachment; filename=\"my-file.txt\""); $data="hey text file, yay \n"; $data .= "it has stuff in it"; ech...