[英]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.