Jump to content


Photo

How do i set permissions chmod Can Someone Help


  • Please log in to reply
7 replies to this topic

#1 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 03 October 2006 - 02:28 AM

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
<?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";}
?>


#2 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 03 October 2006 - 02:47 AM

need help quickly if anyone knows how?

#3 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 03 October 2006 - 03:32 AM

ftp_chmod();

http://usphp.com/man...n.ftp-chmod.php

#4 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 03 October 2006 - 12:16 PM

that is for php 5 only and i am using php 4

#5 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 03 October 2006 - 12:23 PM

so does anyone know how to do it using php 4


#6 FrOzeN

FrOzeN
  • Members
  • PipPipPip
  • Advanced Member
  • 70 posts

Posted 03 October 2006 - 12:25 PM

Read the comment below that function, someone posted an alternative.
http://usphp.com/man...chmod.php#66456

#7 perezf

perezf
  • Members
  • PipPipPip
  • Advanced Member
  • 301 posts
  • LocationFort Lauderdale

Posted 03 October 2006 - 12:43 PM

i still get this error

Fatal error: Call to undefined function: ftp_chmod()



#8 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 03 October 2006 - 01:54 PM

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:
<?php
if (!function_exists('ftp_chmod')) {
   function ftp_chmod($ftp_stream, $mode, $filename)
   {
       return ftp_site($ftp_stream, sprintf('CHMOD %o %s', $mode, $filename));
   }
}
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users