note 63375 added to function.move-uploaded-file

From: Date: Tue, 21 Mar 2006 16:47:47 +0000
Subject: note 63375 added to function.move-uploaded-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-106162@lists.php.net to get a copy of this message
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 } } ---- Server IP: 66.163.161.117 Probable Submitter: 84.180.95.120 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.move-uploaded-file.php Edit -- http://master.php.net/note/edit/63375 Del: integrated -- http://master.php.net/note/delete/63375/integrated Del: useless -- http://master.php.net/note/delete/63375/useless Del: bad code -- http://master.php.net/note/delete/63375/bad+code Del: spam -- http://master.php.net/note/delete/63375/spam Del: non-english -- http://master.php.net/note/delete/63375/non-english Del: in docs -- http://master.php.net/note/delete/63375/in+docs Del: other reasons-- http://master.php.net/note/delete/63375 Reject -- http://master.php.net/note/reject/63375 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#106162) next »