i want to make some .doc files with some entries in a database. here is what i wrote:
$name1=$user->username;
$name2=$nume;
$name3=$_POST['util'];
$cale="../doc/";
$file_name=$name1 . "_" .$name2."_".$name3;
$fp = fopen($cale, $file_name . ".doc", 'w+');
$message="Zhtml>Zbody> <table width='100%' border='0'>
<tr>
<td align='center' width='15%'>Data citire </td>
<td align='center' width='15%'>Index </td>
</tr>
<tr>
<td align='center' width='15%'>CURRENT_DATE()</td>
<td align='center' width='15%'>".$_POST['ind']."</td>
</tr>
</body>
</html>
";
fwrite($fp, $message);
fclose($fp);`
On localhost it works great, but when i upload it to a server it doesn't create the files.. I've set the permissions to 777 but still no luck. also i've tried with other paths, even with no path. still nothing. can someone help?
thank's Sebastian
EDIT: clearly the path is the problem, i made the whole site 777 and the file is created in the root folder. i tried this: $cale=$_SERVER['DOCUMENT_ROOT'].'/components/com_calculator/doc/';
but nothing. any ideas?
$fp = fopen($cale . $file_name . ".doc", 'w+');
That needs changing to what I have put here. You used a comma instead of a period, meaning it was taking it to mean the method was $file_name . ".doc"