Jump to content

How do i set permissions chmod Can Someone Help


perezf

Recommended Posts

i need to know how to set permissions to a folder when it logs in automatically
i want to be able to set the permissions to the ftp.test.com when i log in
[code]<?php
$ftp = @ftp_connect('ftp.test.com');
$login = @ftp_login($ftp, 'username', 'password');
if($ftp && $login) {
echo "You are Connected";
    $ourFileName = "testFile.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);
}
else { echo "You did not Connect";}
?>[/code]
That was FrOzeN's point. There is an alternitive which creates a function called ftp_chmod. If you create the function, then PHP will not error "undefined function".

for simplicity, here is a copy:
[code=php:0]<?php
if (!function_exists('ftp_chmod')) {
  function ftp_chmod($ftp_stream, $mode, $filename)
  {
      return ftp_site($ftp_stream, sprintf('CHMOD %o %s', $mode, $filename));
  }
}
?>[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.