Jump to content

fwrite - chmod


arfa

Recommended Posts

A standard file write routine - generating the file $fname on the first run.
[code=php:0]
$fh = fopen($fname, 'w');
fwrite($fh,$data);
fclose($fh);
[/code]
On the current server the file, $fname, is written with permission and status:
-rw-r--r--  www-data
So... trying to later write to the file doesn't work.
Being www-data it resists standard fTP chmod command.
It also fails:
chmod("$fname", 0666);

Any suggestions or comments here would be most welcome.

thanks
Link to comment
Share on other sites

thanks for the replies.

A bit more testing and it seems we are writing.
The problem still remains with chmoding -
via my FTP prog - error message= Operation not permitted. May not be supported on remote site. Or,

via PHP using: chmod("$fname", 0666);
Link to comment
Share on other sites

ooops, hit the post button....

rasmus/file.gif", "wb");
I am definitely not on a win server (but should get into the 'portability' habit)

via my PHP chmod script using: chmod("$fname", 0666);
I was getting:
Warning: chmod() [function.chmod]: Operation not permitted in /home/ftp/.../....../..
but now see that this is only for directories.

This thread is a bit of a space waster - other than forcing me to write out my process, and examine the various steps and presumptions along the way - AND learn as a result.
sorry about that
thanks for your tolerance
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.