我不知道为什么这不起作用,而奇怪的部分是...它正在工作,现在它不是
在userlogin上运行:
if($query_num_rows==0)
{
echo 'Invalid username/password combination.';
}
else if($query_num_rows==1)
{
echo 'ok';
if(!file_exists ('userdata/'.strtolower($username))){
mkdir("userdata/".strtolower($username));
}
if(!file_exists ('userdata/'.strtolower($username).'/tracks')){
mkdir("userdata/".strtolower($username)."/tracks");
}
if(!file_exists ('userdata/'.strtolower($username).'/artwork')){
mkdir("userdata/".strtolower($username)."/artwork");
}
if(!file_exists ('userdata/'.strtolower($username).'/pdf')){
mkdir("userdata/".strtolower($username)."/pdf");
}
if(!file_exists ('userdata/'.strtolower($username).'/episodes')){
mkdir("userdata/".strtolower($username)."/episodes");
}
为该用户创建目录
并且对于我的所有上传者(上传个人资料图片,照片等)我使用以下命令:
$currentdir = getcwd();
if(isset($_FILES['avtar-file']['name']) && !empty($_FILES['avtar-file']['name'])){
$target = $currentdir .'/userdata/'.$username.'/'. basename($_FILES['avtar-file']['name']);
if($_FILES['avtar-file']['type']=="image/jpeg"||$_FILES['avtar-file']['type']=="image/jpg"||$_FILES['avtar-file']['type']=="image/png"){
move_uploaded_file ( $_FILES['avtar-file']["tmp_name"] , $target );
$avtarPath = 'dashboard/userdata/'.$username.'/'.basename($_FILES['avtar-file']['name']);
}
if(!empty($_POST['avtaroldfilename'])){
$currentPath = dirname(dirname(__FILE__));
if(file_exists($currentPath.'/'.$_POST['avtaroldfilename'])){
unlink($currentPath.'/'.$_POST['avtaroldfilename']);
}
}
}
else if(!empty($_POST['avtaroldfilename'])){
$avtarPath = $_POST['avtaroldfilename'];
}
正在使用755个权限生成用户的文件夹,因为/ userdata具有755个权限
截至目前,它像上传者一直无法正常工作