【发布时间】:2018-12-24 06:30:55
【问题描述】:
$filename = generate_filename($type, $id);
$filepath = "gs://$bucket.appspot.com/uploadedfiles/$filename";
error_log("trying to move ".$_FILES['image']['tmp_name']." to ".$filepath);
if (file_exists($_FILES['image']['tmp_name'])) {
if (move_uploaded_file($_FILES['image']['tmp_name'], $filepath)) {
// ...
} else {
error_log("could not move the uploaded file");
}
}
这是我在日志中看到的:
试图将 /tmp/php69rSck 移动到 gs://my-project.appspot.com/uploadedfiles/sale-image-3-1545631667.1964.jpg
无法移动上传的文件
如何确定失败的原因?
【问题讨论】:
-
文件大小是多少?
move_uploaded_file()报告的错误消息是什么?App Engine 的文件大小限制为 32 MB。 -
@JohnHanley 我尝试了几张不同的图片,所有图片都低于 100k。
-
您调用的 Google API 返回的错误信息是什么?这会给你一个真正的线索。
标签: php google-app-engine google-cloud-platform google-cloud-storage php-7.2