• Hi

    I am writing a plugin and I need some help.
    I want the user to be able to download text which is in a php variable.
    How can I make this variable downloadable?

    Thanks in advance 😀

    -Anton

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You need to use the various PHP file handling functions to create a .txt file. Place it in a folder with the proper permissions, as well as setting the file permissions so anyone can read it. Provide the file URL to the user for download.

    Alternately, you could echo out the variable from within a custom template that has sent a ‘text’ mime type header. It’s not truly downloadable because it is not a file, but it’ll show up in the user’s browser as a text document.

Viewing 1 replies (of 1 total)

The topic ‘Download var’ is closed to new replies.