简体   繁体   English

使用Google Cloud Storage显示文件上传进度

[英]Display file uploading progress with Google Cloud Storage

I have a web app which allows users to upload files to Google Cloud Storage on behalf of my web app. 我有一个网络应用程序,允许用户代表我的网络应用程序将文件上传到Google Cloud Storage。 I already implemented a simple feature successfully using an HTML POST Form, described here . 我已经实现了一个简单的功能成功地使用HTML POST的形式,描述在这里

While a user uploads a file, I would like to display information such as remaining percentage of file uploading, transferring rate, and so on. 用户上载文件时,我想显示诸如文件上载的剩余百分比,传输速率等信息。 I find nowhere in the documentation that explains this topic, and have no idea how to start with. 我在解释该主题的文档中找不到任何地方,也不知道如何开始。 Would appreciate your suggestion or relevant references. 希望您的建议或相关参考。

I found a really simple solution which works great for me :) 我找到了一个非常简单的解决方案 ,对我很有用:)

An extra work I need is to configure CORS with gsutil setcors my-bucket-cors.xml gs://my-bucket . 我需要做的额外工作是使用gsutil setcors my-bucket-cors.xml gs://my-bucket配置CORS。

my-bucket-cors.xml contains: my-bucket-cors.xml包含:

<?xml version="1.0" encoding="UTF-8"?>
<CorsConfig>
    <Cors>
        <Origins>
            <Origin>http://my-web-app.com</Origin>
        </Origins>
        <Methods>
            <Method>GET</Method>
            <Method>HEAD</Method>
            <Method>POST</Method>
            <Method>DELETE</Method>
            <Method>PUT</Method>
        </Methods>
        <ResponseHeaders>
            <ResponseHeader>*</ResponseHeader>
        </ResponseHeaders>
        <MaxAgeSec>1800</MaxAgeSec>
    </Cors>
</CorsConfig>

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

相关问题 使用NodeJS REST API通过Google云端存储获取文件上传进度 - Get file uploading progress with Google Cloud Storage using NodeJS REST API 在 node.js 中将文件上传到 Google Cloud Storage 时出错 - Error when uploading file to Google Cloud Storage in node.js 将其他元数据作为文件上传请求的一部分上传到Google Cloud Storage - Uploading additional metadata as part of file upload request to Google Cloud Storage NextJS 文件上传到谷歌云存储成功但总是上传 0 字节文件 - 使用强大 - NextJS file upload to Google Cloud Storage successful but always uploading 0 byte file - using formidable React + Firebase Storage + 文件上传和进度显示 - React + Firebase Storage + File upload and progress display 将文件上传到 Google Storage 而不将其保存到内存 - Uploading file to Google Storage without saving it to memory 通过进度条从Android恢复到Google Cloud Storage的上传 - Resumable upload to Google Cloud Storage from Android with progress bar 将图像文件上传到Google云存储桶 - Uploading image file to google cloud bucket 文件上传进度条? - Progress bar for File Uploading? 将 zip 文件夹上传到云存储 - Uploading a zip folder to cloud storage
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM