Forums

PHP

This topic is locked

fopen problem

Posted 24 Jan 2008 09:57:15
1
has voted
24 Jan 2008 09:57:15 Alan C posted:
I am having a hard time with fopen - the site my site is using php5.

permissions on the file I'm trying to open are 666, name is details.txt

I've tried testing whether the file exists like this . . .

<pre id=code><font face=courier size=2 id=code> $details_exists=file_exists('../artists/chard/images/details.txt'); // true or false
echo 'file tested was '.'../artists/chard/images/details.txt'.' $details_exists was: '.$details_exists.'&lt;br /&gt;';
if($details_exists!==true) echo 'No details.txt file was found at line 39 &lt;br /&gt;';
else
echo "A details file exists at line 41 &lt;br /&gt;";
</font id=code></pre id=code>

that appears to work as I get the appropriate printout.

But, when I go on a few lines to . . .

<pre id=code><font face=courier size=2 id=code>$this_file='../artists/chard/images/details.txt';
echo 'attempt to open : '.$this_file.'&lt;br /&gt;';

$file_handle=fopen($this_file,'w+'); // open file for write
</font id=code></pre id=code>

I get a cryptic error message that just says . . .

Unable to open

I have tried different paths, like

/home/listento/public_html/artists/chard/images/details.txt
/www/artists/chard/images/details.txt

but no joy with any of them

Any advice or suggestions welcome.

Replies

Replied 24 Jan 2008 11:24:40
24 Jan 2008 11:24:40 Alan C replied:
I'n not sure exactly what the problem was, but by starting again with a clean file I got it working, I suspect 'finger trouble' - anyway it's working, I don't have time to pour over the code any longer <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 24 Jan 2008 13:29:55
24 Jan 2008 13:29:55 Vince Baker replied:
nothing more irritating than that is there.....start with a clean page and everything works!

this is why I am grey.....

Regards

Vince Baker
<strong>DMX Zone Manager</strong>

[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]

Reply to this topic