doulandai0641 2015-02-15 20:35
浏览 62

php move_uploaded_file在移动后将文件锁定,如何从锁中释放文件?

After moving files using move_uploaded_file the files are locked from further modification (such as rename). This is on my local server (localhost) running Ubuntu 14 and using Codeigniter framework. The upload directory is set to 777 (I know bad, but its just easier for my dev environment). This does not appear to be happening in production. They remain locked after the script is complete and even after the browser is closed. Here is the code.

public function upload_photos($pid = '', $timestamp = 0, $files = array()) {
    $uploadpath = $this->post_model->photo_upload_path($timestamp);

    $count = 0;
    foreach ($files as $file) {
        $file["tmp_name"] !== '' ? $check = getimagesize($file["tmp_name"]) : $check = FALSE;
        if ($check !== FALSE && $file["size"] <= MAX_PHOTO_SIZE) {
            $target_file = $uploadpath . 'dd-' . $pid . '-' . $count . '.' . strtolower(end(explode('.', $file['name'])));
            if (move_uploaded_file($file["tmp_name"], $target_file)) {
                $count++;
            }
        }
    }
    return $count;
}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 c语言写的8051单片机存储器mt29的模块程序
    • ¥60 求直线方程 使平面上n个点在直线同侧并且距离总和最小
    • ¥50 java算法,给定试题的难度数量(简单,普通,困难),和试题类型数量(单选,多选,判断),以及题库中各种类型的题有多少道,求能否随机抽题。
    • ¥50 rk3588板端推理
    • ¥250 opencv怎么去掉 数字0中间的斜杠。
    • ¥15 这种情况的伯德图和奈奎斯特曲线怎么分析?
    • ¥250 paddleocr带斜线的0很容易识别成9
    • ¥15 电子档案元素采集(tiff及PDF扫描图片)
    • ¥15 flink-sql-connector-rabbitmq使用
    • ¥15 zynq7015,PCIE读写延时偏大