perezf Posted October 3, 2006 Share Posted October 3, 2006 i need to know how to set permissions to a folder when it logs in automaticallyi 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] Quote Link to comment Share on other sites More sharing options...
perezf Posted October 3, 2006 Author Share Posted October 3, 2006 need help quickly if anyone knows how? Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted October 3, 2006 Share Posted October 3, 2006 ftp_chmod();http://usphp.com/manual/en/function.ftp-chmod.php Quote Link to comment Share on other sites More sharing options...
perezf Posted October 3, 2006 Author Share Posted October 3, 2006 that is for php 5 only and i am using php 4 Quote Link to comment Share on other sites More sharing options...
perezf Posted October 3, 2006 Author Share Posted October 3, 2006 so does anyone know how to do it using php 4 Quote Link to comment Share on other sites More sharing options...
FrOzeN Posted October 3, 2006 Share Posted October 3, 2006 Read the comment below that function, someone posted an alternative.http://usphp.com/manual/en/function.ftp-chmod.php#66456 Quote Link to comment Share on other sites More sharing options...
perezf Posted October 3, 2006 Author Share Posted October 3, 2006 i still get this error[quote]Fatal error: Call to undefined function: ftp_chmod()[/quote] Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted October 3, 2006 Share Posted October 3, 2006 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]<?phpif (!function_exists('ftp_chmod')) { function ftp_chmod($ftp_stream, $mode, $filename) { return ftp_site($ftp_stream, sprintf('CHMOD %o %s', $mode, $filename)); }}?>[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.