How do I save a file to a server with the name depending on a variable in
PHP?
So I tried this:
$filemessage = "blablablabla";
$File = "{$date} _ {$subject} _ {$receiver}.txt";
$Handle = fopen($File, 'w');
$Data = $filemessage;
fwrite($Handle, $Data);
fclose($Handle);
But the it will give me this error:
Warning: fopen(18-08-2013_a subject_an email.txt) [function.fopen]: failed
to open stream: No such file or directory in 'the directory' line 88
Warning: fwrite() expects parameter 1 to be resource, boolean given in
'the directory' on line 90
Warning: fclose() expects parameter 1 to be resource, boolean given in
'the directory' on line 91<br>
Without the variables in $file the code works only with the variables it
gives these errors. But it does give the correct name for the file I want
but it cant save it or something. How can i solve this?
No comments:
Post a Comment