我正在通过HTML表单和PHP代码为App Engine设置新的上传文件
我已经查看了官方文档,并且还查看了Internet上的许多资源。我什么都没找到我还使用了此视频https://www.youtube.com/watch?v=_d9dugx-cHE
function upload_object($bucketName, $objectName, $source) {
$storage = new StorageClient();
$file = fopen($source, 'r');
$bucket = $storage->bucket($bucketName);
$object = $bucket->upload($file, [
'name' => $objectName
]);
printf("Uploaded %s to gs://%s/%s".PHP_EOL, basename($source), $bucketName, $objectName);
}
if(($_FILES)) {
$file_handle = fopen($_FILES['uploaded_files']['tmp_name'], 'r');
upload_object($bucketName.'.appspot.com', $_FILES['uploaded_files']['name'], $_FILES['uploaded_files']['tmp_name']);
var_dump($_FILES);
echo '\n\n';
var_dump($file_handle);
}
<form action="" enctype="multipart/form-data" method="post">
Files to upload: <br>
<input type="file" name="uploaded_files" size="40">
<input type="submit" value="Send">
</form>
我的错误消息很长。开头为:
int(404)字符串(165)“ {” error“:{” errors“:[{” domain“:” global“, “ reason”:“ notFound”,“ message”:“ Not Found”}],“ code”:404, “ message”:“未找到”}}