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";  echo $data;  ?> 

in drupal there function wraps header() , stores headers statically in array:

http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_set_header/6

which can retrieved with:

http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_get_header/6


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -