【问题标题】:File Permissions Using Dropzone.js使用 Dropzone.js 的文件权限
【发布时间】:2015-06-05 14:05:32
【问题描述】:

当我使用 dropzone.js 将文件上传到我的上传目录时,它们会自动分配为只读状态。上传文件的目录和执行文件上传的操作目录(我在centOS 7中使用symfony 1.4)有drwxrwxrwx和drwxrwxrwx。分别权限。我也是目录的所有者。

如何在使用 dropzone.js 上传文件后异步分配 rwx 权限?

文件上传动作:

$ds          = DIRECTORY_SEPARATOR;  //1

$storeFolder = '../uploads';   //2

if (!empty($_FILES)) {

    $tempFile = $_FILES['file']['tmp_name'];          //3

    $targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;  //4

    $targetFile =  $targetPath. $_FILES['file']['name'];  //5

    move_uploaded_file($tempFile,$targetFile); //6

    $this->redirect('beep/boop?id=' . $goop);
}

【问题讨论】:

    标签: symfony-1.4 dropzone.js centos7


    【解决方案1】:
        ...
        /**
         * Set file permissions after moving it to target folder
         */
        chmod($targetFile, 0700); //rwx only for owner 
        ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-28
      • 2013-08-05
      • 2015-06-02
      • 2015-06-13
      • 2015-08-19
      • 2010-10-20
      相关资源
      最近更新 更多