so using that i have... function FtpMkdir($FTPpath, $id) { $server='www.myserver.com'; // ftp server $connection = ftp_connect($server); // connection // login to ftp server $user = "user"; $pass = "pass"; $result = ftp_login($connection, $user, $pass); // check if connection was made if ((!$connection) || (!$result)) { return false; exit(); } else { ftp_chdir($connection, $FTPpath); // go to destination dir if(ftp_mkdir($connection,$id)) { // create directory return $id; } else { return false; } ftp_close($conn_id); // close connection } } ############################################ if(isset($_POST['addnew'])) { $FTPpath= '/httpdocs/compFiles/'; $id='entry_'.$_POST['rid']; //new dir name $path= '/var/www/vhosts/mydomain.com/httpdocs/compFiles/'.$id; if(!is_dir($path)) { FtpMkdir($FTPpath, $id); // make dir } if(is_dir($path)) // directory already exists { chmod($path, 0707); if ($_FILES['file_upld']['tmp_name']) //upload file { $temp_name = $_FILES['file_upld']['tmp_name']; $filename = $_FILES['file_upld']['name']; $dir = $path.'/'; move_uploaded_file($temp_name,$dir.$filename); chmod($dir.$filename, 0707); $success = "<font color=\"green\">Your file was uploaded successfully</font>"; } } } Which now creates a directory that at least doesn't belong to apache, has permissions 755 but doesn't upload the file ,unless i change the permissions to 707 , and chmod($path, 0707); nor chmod($dir.$filename, 0707); seem to be working...