簡體   English   中英

使用Google Cloud Storage顯示文件上傳進度

[英]Display file uploading progress with Google Cloud Storage

我有一個網絡應用程序,允許用戶代表我的網絡應用程序將文件上傳到Google Cloud Storage。 我已經實現了一個簡單的功能成功地使用HTML POST的形式,描述在這里

用戶上載文件時,我想顯示諸如文件上載的剩余百分比,傳輸速率等信息。 我在解釋該主題的文檔中找不到任何地方,也不知道如何開始。 希望您的建議或相關參考。

我找到了一個非常簡單的解決方案 ,對我很有用:)

我需要做的額外工作是使用gsutil setcors my-bucket-cors.xml gs://my-bucket配置CORS。

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM