dpv21589 2016-06-25 14:46
浏览 75

动态创建文件时,在服务器上拒绝php脚本权限

I'm stuck on letting php create files on my server from the html forms output. It doesn't have permission to create these files. I tried different approaches I around here but can't get it to work.

Here's my code which creates the file from the Form data:

$file = 'r-data/car-form-data-'.time().'-'.rand(1000,9999).'.JSON';
file_put_contents($file, json_encode($_POST));

Is somebody able to help to make this approach work?

Thank you.

  • 写回答

1条回答 默认 最新

  • 普通网友 2016-06-25 15:29
    关注

    Maybe www-data doesn't have right to write on your folder. Try chmod -R 777 on your folder or set acl.

    评论

报告相同问题?