php - mkdir 上的 file_put_contents 无法打开流:权限被拒绝
问题描述
我正在尝试从我开发的应用程序上传图像。我不断收到此错误failed to open stream: Permission denied
。
这是我在 PHP 5.6 上的代码
$target_dir = '../../uploads/temp/'.$username.'/'.$acad_year.'/'.$semester;
if (!is_dir($target_dir))
{
mkdir($target_dir, 777, TRUE);
}
file_put_contents($target_dir, base64_decode($_POST['image']));
这是错误
file_put_contents(../../uploads/temp/asdasda/2019-2020/2nd): failed to open stream: Permission denied in <b>C:\xampp\htdocs\sfas\android_app\v1\UploadPicture.php</b>
我做了一些研究,但没有任何效果。
解决方案
推荐阅读
- javascript - 在 DataTable 中转换 JSON 日期
- jpgraph - jpgraph 折线图值被标记隐藏
- javascript - 4个百分比输入框,如何动态调整数值到100%
- bamboo - 竹脚本构建计划
- apache-spark - Spark - 如何针对 RDD 中的大量列优化 Row 对象
- javascript - 为什么此 mouseenter 事件不适用于标签内的标签
- php - 查找字符串中任何大于某个数字的数字第一次出现的位置
- pandas - 使用熊猫有条件地更新多索引框架
- javascript - 无法在简单的 jQuery 循环中获取未定义或空引用的属性“nodeValue”
- javascript - 单选按钮 Checked 属性在 JsViews 中不起作用