Jump to content

Recommended Posts

i have a misc class and i just added it as a method to that class

[code]
in my misc class

    public function exportFile($data, $filename){
        
        header("Content-type: application/octet-stream");
        header("Content-Disposition: attachment; filename=". $filename ."");
        header("Pragma: no-cache");
        header("Expires: 0");
        echo trim($data);
    }
[/code]

how i am callin it

[code]
LMS_Misc::exportFile("asdfasdF", "test.txt");
[/code]

my result is:
"
asdfasdF"

**there is even a carriage return in there

what am i doing wrong?
thanks

it looks like the .txt file starts of with a space then a return then two tabs
i changed the filetype to csv and i get two little squares in front of the data


it has somethign to do with the class that i am placing the method in. i put it in its own class and it is working fine. its time for me to go home so i will do some more testing tomorrow!!!! thanks
acutally now that ived placed the function in its own class and file, i still get this error. its from me calling the class from a page that includes common.php (which sets the constant variables). i hae no idea what the problem is. any help
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.