Jump to content

Recommended Posts

im using mkdir and chmod to create dir, copy files into the created dir and to chmod it (anything but 777).. like:

[code]    if(!is_dir("$ausername")) {
        mkdir("$ausername", 0755);
        @chmod("$ausername", 0755);
        copy("stu_index.html", "$ausername/index.html");
        @chmod("$ausername/index.html", 0755);
    }[/code]


*the problem is i cant add files via ftp to the created folder or even delete it..

[code]    if(!is_dir("$ausername")) {
        mkdir("$ausername", 0777);
        @chmod("$ausername", 0777);
        copy("stu_index.html", "$ausername/index.html");
        @chmod("$ausername/index.html", 0777);
    }[/code]


*only when i use php to mkdir and chmod it to 777, then i am able to add files and or del the folder via ftp..

i wonder how can i not chmod the file and folder 777 yet able to edit things via ftp ? im using a shared unix host..

thanks in advance!
Link to comment
https://forums.phpfreaks.com/topic/13709-php-chmod-and-ftp-problem/
Share on other sites

mkdir and chmod are only effective for the PHP script. It wont set the permission for the folder/file forever

If you want to ftp stuff to the folder you can do by logging in to your FTP client, going to the folder, right click it and select properties or change permissions. You sholud be able to change the permissions for the file/folder. If not your host may have disabled this or the server is a Windows server and doesnt support CHMOD permissions.
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.