简体   繁体   English

谷歌云图片上传报错javascript

[英]Google cloud image upload Error javascript

I'm trying to upload an image on Google cloud console with javascript, but it's not working at all.我正在尝试使用 javascript 在 Google 云控制台上上传图片,但它根本无法正常工作。

I have tried with the multiple post URL's https://storage.googleapis.com/upload/storage/v1/b/${bucketName}/o/ https://storage.googleapis.com/upload/storage/v1/b/${bucketName}/o?uploadType=media&name=${filename}我尝试使用多个帖子 URL https://storage.googleapis.com/upload/storage/v1/b/${bucketName}/o/ https://storage.googleapis.com/upload/storage/v1/b /${bucketName}/o?uploadType=media&name=${filename}

but none of them works, it always says 404 not found.但它们都不起作用,它总是说 404 未找到。

I want to upload the image on google cloud console with help of Javascript or jQuery我想在 Javascript 或 jQuery 的帮助下将图片上传到谷歌云控制台

A POST to the second URL pattern you listed, https://storage.googleapis.com/upload/storage/v1/b/BUCKET_NAME/o?uploadType=media&name=OBJECT_NAME , is correct.您列出的第二个 URL 模式https://storage.googleapis.com/upload/storage/v1/b/BUCKET_NAME/o?uploadType=media&name=OBJECT_NAME的 POST 是正确的。

There are several alternatives you could try, for example a PUT to the pattern https://storage.googleapis.com/BUCKET_NAME/OBJECT_NAME .您可以尝试多种替代方法,例如 PUT 模式https://storage.googleapis.com/BUCKET_NAME/OBJECT_NAME

Getting a 404 is unexpected and somewhat hard to diagnose without the exact URL. The most obvious cause would be that a bucket of that name doesn't exist.如果没有确切的 URL,获得 404 是意外的并且有点难以诊断。最明显的原因是该名称的存储桶不存在。 Check for typos?检查错别字? The second most likely reason is that you are accidentally doing a PUT or a GET instead of a POST.第二个最可能的原因是您不小心执行了 PUT 或 GET 而不是 POST。

Try making the same call with cURL, wget, or similar to see if you can reproduce the issue with another tool.尝试使用 cURL、wget 或类似工具进行相同的调用,看看是否可以使用其他工具重现该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法在谷歌云上上传图像 mikrotik-chr - Cant Upload image mikrotik-chr on google cloud ENOENT no such file or directory error in cloud function 上传图片 - ENOENT no such file or directory error in cloud function upload image 如何在没有 JavaScript 令牌的情况下将文件上传到谷歌云存储 - How can I upload files to google cloud storage without token in JavaScript 如何将本地视频文件上传到 Google Cloud - How to upload local video file to Google Cloud 从字节上传谷歌云存储失败 - google cloud storage upload from bytes fails 使用谷歌云 sdk 在 GCS 存储桶上上传数据时,Kube.netes cronjob 出现错误 - Getting error in Kubernetes cronjob while using google cloud sdk to upload data on GCS bucket 如何将文件上传到谷歌云文件存储? - How to upload file to Google Cloud Filestore? 如何使用 java 在谷歌云中上传文件夹? - How to upload Folder in google cloud using java? 如何将文件上传到 Python 3 上的 Google Cloud Storage? - How to upload a file to Google Cloud Storage on Python 3? 在谷歌云中执行谷歌云 function 时出错,但在本地工作正常 - Error executing google cloud function in google cloud, but working fine in local
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM