Hi guys,
Well, this is my first thread. If I mess it up, or am not following rules, please let me know. :p
Im having some trouble with "touch" and "fopen" functions in php. I get the following errors when trying to create a file, the write to it:
Warning: touch() [function.touch]: Unable to create file _private/rawdata.csv because Permission denied in xxxx\form7.php on line 383
Warning: fopen(_private/rawdata.csv) [function.fopen]: failed to open stream: Permission denied in xxxx\form7.php on line 386
Can't open file
Firstly, I encountered this before with ASP. It was just a permissions error on the folder, write access was added to fix it. The hosting guys say it has write access (I beg to differ!!). :bemused:
Also, the fopen option in the php configuration is enabled, so it cant be that. 😕
I have also heard the using the "a" option with fopen doesnt always work, and can give that error. Thats possible, but then why does the "touch" function also give the exact same error? It cant be that then, right? 😕
Here is the code for my php file:
// add data to CSV file
// set name of file
$FileName = "rawdata.csv";
// check if it exists, if not, create the file
if (!file_exists($FileName)) {
touch($FileName);
// try to open the file
$Handle1 = fopen($FileName, "a") or die ("Can't open file");
// try to write to open file
fwrite($Handle1, $Headings) or die ("Can't write to file");
// close the file
fclose($Handle1);
}
// try to open the file
$Handle2 = fopen($FileName, "a") or die ("Can't open file");
// try to write to open file
fwrite($Handle2, $Data) or die ("Can't write to file");
// close the file
fclose($Handle2);[/B]
PS, when testing it on my pc, it runs 100%, upload it to the server, and I get the error messages above. 😉
Please help!! Google searches havent helped much!