How to pass (chmod 777) permission while writing a file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

How to pass (chmod 777) permission while writing a file

Post by eshban »

Hi,

I have just writing a file by using fwrite method. But when i upload my code and check it online, it does not allow my code to write my file.

Please guide that how can i pass PERMISSION (777) in my PHP code while writing the file.

Thank you
User avatar
dibyendrah
Forum Contributor
Posts: 491
Joined: Wed Oct 19, 2005 5:14 am
Location: Nepal
Contact:

Post by dibyendrah »

Code: Select all

<?php
chmod("file_name", 0777);
?>
But don't do 777 as it's not secure as well and server might not allow to do that as well. Safe will be do 666 rather than 777.
Post Reply