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] Link to comment https://forums.phpfreaks.com/topic/22820-how-do-i-set-permissions-chmod-can-someone-help/ 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? Link to comment https://forums.phpfreaks.com/topic/22820-how-do-i-set-permissions-chmod-can-someone-help/#findComment-102805 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 Link to comment https://forums.phpfreaks.com/topic/22820-how-do-i-set-permissions-chmod-can-someone-help/#findComment-102813 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 Link to comment https://forums.phpfreaks.com/topic/22820-how-do-i-set-permissions-chmod-can-someone-help/#findComment-102989 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 Link to comment https://forums.phpfreaks.com/topic/22820-how-do-i-set-permissions-chmod-can-someone-help/#findComment-102995 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 Link to comment https://forums.phpfreaks.com/topic/22820-how-do-i-set-permissions-chmod-can-someone-help/#findComment-102998 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] Link to comment https://forums.phpfreaks.com/topic/22820-how-do-i-set-permissions-chmod-can-someone-help/#findComment-103007 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] Link to comment https://forums.phpfreaks.com/topic/22820-how-do-i-set-permissions-chmod-can-someone-help/#findComment-103064 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.