0

what's wrong with this code? it works fine except when i download the file there's nothing in the file and i've tried removing the unlink.

$F = fopen("filename","w");
fwrite($F,"blah");
fclose($F);
header('Content-Disposition: attachment; filename=title');
unlink("filename");
2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by nav33n
0

First of all, you dont have an extension to the file. secondly, you aren't writing anything to the file.
Eg.

<?php
header('Content-Disposition: attachment; filename=filename.txt');
echo "blah blah";
?>
0

First of all, you dont have an extension to the file. secondly, you aren't writing anything to the file.
Eg.

<?php
header('Content-Disposition: attachment; filename=filename.txt');
echo "blah blah";
?>

i do have an extesion i was just putting random stuff in there i had stuff like blah.html or blah.txt. Also i did write something to the file because when i remove the unlink part and go to the file that i just created there's contents in the file.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.