我有这个简单的代码
mkdir('Users', 0775);
但是当我进入我的目录时,这就是我所看到的
drwxr-xr-x 4 www-data www-data 1M Jun 11 16:30 Users
我希望看到
drwxrwxr-x 4 www-data www-data 1M Jun 11 16:30 Users
什么可能弄乱我的权限?
答案 0 :(得分:0)
如果您使用
mkdir('Users')
chmod('Users', 0775)
这可以解决您的问题,但请记住,在Windows上忽略模式,但您可以使用chmod更改权限。见mode is ignored on Windows.
答案 1 :(得分:0)
umask可能会影响您的脚本。您可以尝试通过PHP临时修改它:http://php.net/manual/en/function.umask.php
public class AlertDialogFragment extends DialogFragment {
private final static String TAG = "Cload";
public static final String EXTRA_PHOTOFILENAME =
"com.example.tadas.dreamcload1.image";
private static final int REQUEST_IMAGE = 3;
private String filename;
private Uri uri;
private void sendResult(int resultCode) {
if(getTargetFragment() == null){return;}
Intent i = new Intent();
i.putExtra(EXTRA_PHOTOFILENAME,filename);
getTargetFragment()
.onActivityResult(getTargetRequestCode(), resultCode, i);
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
//LayoutInflater inflater = getLayoutInflater();
// View dialogLaout = inflater.inflate(R.layout.custom_dialog_pick_image,null);
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.custom_dialog_pick_image, null);
final AlertDialog dialog = new AlertDialog.Builder(getActivity())
.setView(view)
.create();
ImageButton gallerybtn = (ImageButton)view.findViewById(R.id.gallery);
ImageButton camerabtn = (ImageButton)view.findViewById(R.id.camera);
gallerybtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.e(TAG,"gallery btn pressed");
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, REQUEST_IMAGE);
}
});
camerabtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
return dialog;
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_IMAGE && resultCode == Activity.RESULT_OK){
uri = data.getData();
final String[] filePathColumn = {MediaStore.MediaColumns.DATA, MediaStore.MediaColumns.DISPLAY_NAME};
Cursor c = getActivity().getContentResolver()
.query(uri,filePathColumn,null,null,null);
if (c.moveToFirst()){
int ids = c.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
uri = Uri.parse(c.getString(ids));
filename = uri.toString();
c.close();
}
sendResult(Activity.RESULT_OK);
dismiss();
}
}
您还可以尝试在创建目录后更改权限:
$old = umask(0);
mkdir('Users', 0775);
umask($old);
...建议在多线程Web服务器上使用。