在用七牛云上传图片时,出现了以下错误
fatal error: uncaught exception 'exception' with message 'file can not open' in /var/www/html/includes/src/qiniu/storage/uploadmanager.php:91 stack trace: #0 /var/www/html/includes/cls_image.php(150): qiniustorageuploadmanager->putfile('2khh1hthknywvgl...', 'images/201609/g...', 'images/201609/s...') #1 /var/www/html/admin/goods.php(1132): cls_image->qiniuupload('images/201609/s...', 'goods_img') #2 {main} thrown in /var/www/html/includes/src/qiniu/storage/uploadmanager.php on line 91
在用七牛云上传图片时,出现了以下错误
fatal error: uncaught exception 'exception' with message 'file can not open' in /var/www/html/includes/src/qiniu/storage/uploadmanager.php:91 stack trace: #0 /var/www/html/includes/cls_image.php(150): qiniustorageuploadmanager->putfile('2khh1hthknywvgl...', 'images/201609/g...', 'images/201609/s...') #1 /var/www/html/admin/goods.php(1132): cls_image->qiniuupload('images/201609/s...', 'goods_img') #2 {main} thrown in /var/www/html/includes/src/qiniu/storage/uploadmanager.php on line 91
$_FILES['input-file-name']['tmp_name']public function putFile(
$upToken,
$key,
$filePath,
$params = null,
$mime = 'application/octet-stream',
$checkCrc = false
) {
$file = fopen($filePath, 'rb'); //文件不存在,或者不可读
if ($file === false) { //文件为空
throw new \Exception("file can not open", 1); //抛出错误的地方
}
$params = self::trimParams($params);
$stat = fstat($file);
$size = $stat['size'];
if ($size <= Config::BLOCK_SIZE) {
$data = fread($file, $size);
fclose($file);
if ($data === false) {
throw new \Exception("file can not read", 1);
}
return FormUploader::put(
$upToken,
$key,
$data,
$this->config,
$params,
$mime,
$checkCrc
);
}
$up = new ResumeUploader(
$upToken,
$key,
$file,
$size,
$params,
$mime,
$this->config
);
$ret = $up->upload();
fclose($file);
return $ret;
}
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号