Forum Moderators: coopster

Message Too Old, No Replies

mysterious problem with fopen and

         

scorpion

3:45 pm on Apr 26, 2003 (gmt 0)

10+ Year Member



I have a strange problem:

I have a file in a directory called movie.avi with 1mb. The directory is 777.

I issue command:

$writeback = fopen("movie.avi", "w");

and get:

Warning: fopen("movie.avi", "w") - Permission denied in ... on line 66

Why does it do this, it should overwrite the existing file...

If I choose a different file name, one that didn't exist originally in the directory, it writes it no problem, over and over again. Of course it is always 0 bytes..

Any idea why this might be happening. Could it be someone else is downloading the file from my server as I'm trying to issue this command?

Fischerlaender

7:02 pm on Apr 26, 2003 (gmt 0)

10+ Year Member



Did you check the privileges of your file movie.avi? You just mentioned your directory is 777, but to write to (actually delete) movie.avi, your script needs write privilege for it.

scorpion

7:59 pm on Apr 26, 2003 (gmt 0)

10+ Year Member



is there a php command that can set the permissions of a file?

Fischerlaender

8:25 pm on Apr 26, 2003 (gmt 0)

10+ Year Member



Try chmod [php.net].

<edit>changed URL to englisch manual page</edit>