note 63375 deleted from function.move-uploaded-file by bjori

From: Date: Tue, 21 Mar 2006 17:02:45 +0000
Subject: note 63375 deleted from function.move-uploaded-file by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106168@lists.php.net to get a copy of this message
Note Submitter: bofh =at= shareyourride.net Reason: bad code ---- in case you want to create a folder via php and move your uploaded file into it on a shares webspace, you may experience problems with file permissions and cant use this folder to store files - chmod() also dosnt works in this case. try this to create a folder with your ftp-user permissions: function ftpcreate($folder) { $host = "127.0.0.1"; $user = "ftp-username"; $pass = "ftp-password"; $chmod = 775; $conn = ftp_connect($host); $login_result = ftp_login($conn, $user, $pass); if ((!$conn) || (!$login_result)) { echo "panic: cant connect!"; die; } ftp_mkdir($conn, $folder); ftp_chmod($conn, $chmod, $folder); ftp_quit($conn); } // add this for php4: if (!function_exists('ftp_chmod')) { function ftp_chmod($ftpstream,$chmod,$file) { $old=error_reporting();//save old error_reporting(0);//set to none $result=ftp_site($ftpstream, "CHMOD ".$chmod." ".$file); error_reporting($old);//reset to old return $result;//will result TRUE or FALSE } }

« previous php.notes (#106168) next »