at the end of your script add this line echo $filecontent; You have the headers correct, you just aren't actually pushing the data back to the client. Thank you, Ryan Sexton On Nov 22, 2005, at 4:26 PM, Sergio de A.Gonzalez wrote: Hi everybody. I'm trying to download a file(a text file) from within my application, but no sucess. The file is downloaded, but empty. Below is my code. What I'm doing wrong? Thanks, Sergio <?php // load content into var $filecontent="Some text/code im creating in the script"; $downloadfile="myfile.txt"; header("Content-disposition: attachment; filename=$downloadfile"); header("Content-length", filesize("$filename")); header("Content-Length: ".strlen($filecontent)); header("Content-type: text/plain"); header("Content-Type: application/force-download"); header("Content-Transfer-Encoding: binary"); header("Pragma: no-cache"); header("Expires: 0"); ?> PHP Data object relational mapping generator - http://www.meta-language.net/ Yahoo! Groups Links ------------------------ Yahoo! Groups Sponsor --------------------~--> 1.2 million kids a year are victims of human trafficking. Stop slavery. http://us.click.yahoo.com/WpTY2A/izNLAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> PHP Data object relational mapping generator - http://www.meta-language.net/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/