Jump to content

Archived

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

perezf

How do i set permissions chmod Can Someone Help

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]

Share this post


Link to post
Share on other sites
that is for php 5 only and i am using php 4

Share this post


Link to post
Share on other sites
so does anyone know how to do it using php 4

Share this post


Link to post
Share on other sites
Read the comment below that function, someone posted an alternative.
http://usphp.com/manual/en/function.ftp-chmod.php#66456

Share this post


Link to post
Share on other sites
i still get this error
[quote]Fatal error: Call to undefined function: ftp_chmod()[/quote]

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites

×

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.