Easy question regarding quotation marks in php
Posted: Tue Apr 13, 2004 12:37 pm
Hi,
I've got a problem redirecting to a file because my filename has a " ' " (apostrophe) in it.
If I need to redirect to "It's_Some_File.txt" the php tries to read "It.txt" and save "It.txt" using for example this code below.
I know that it's just because as soon as it hits the ' it just stops reading the filename but with echo etc you can play around with where you put quotation marks and which kind you use to make sure it still outputs the entire string.
Is there a way to get my reidrect to work?
I've got a problem redirecting to a file because my filename has a " ' " (apostrophe) in it.
If I need to redirect to "It's_Some_File.txt" the php tries to read "It.txt" and save "It.txt" using for example this code below.
Code: Select all
$file = "It's_Some_File";
header ('Content-type: Text/Plain');
header ('Content-Disposition: attachment; filename="'.$file.'.txt"');
readfile (''.$file.'.txt');Is there a way to get my reidrect to work?