![](/img/trans.png)
[英]How can I upload multiple photos in one post on Google+ from G+ Android SDK?
[英]Upload multiple photos from Google Photos
目標是能夠在 Android 設備上從 Google 相冊中選擇多張照片,並使用常規的 html 文件輸入控件上傳它們。
我可以選擇多張照片,但只上傳了一張...
使用圖庫我可以上傳多張照片。 知道為什么嗎?
這是一個測試人員: https : //jsfiddle.net/7sL1v46e/
<input id="fileInput" type="file" multiple accept="image/*">
選擇多個文件時,將顯示在文件輸入前面的所選文件的數量。
編輯 1:包括屬性 accept="image/*"。 如果照片來源是 Google 相冊,仍然無法正常工作
我以前也遇到過同樣的問題。 我使用以下代碼繞過了我的問題:
<input type="file" id="fileInput" multiple accept="image/*">
如果您只想上傳指定的文件類型,請嘗試使用:
<input type="file" id="fileInput" multiple accept="image/*,.jpg,.png"/>
這里同樣的問題。 Google相冊選擇器允許在Chrome上進行多項選擇,但僅返回一個文件。
Firefox尚不支持多個文件選擇: https : //caniuse.com/#feat=input-file-multiple
關於Chromium的錯誤報告與此有關,但沒有活動跡象: https : //bugs.chromium.org/p/chromium/issues/detail?id=348912
猜猜我們必須等待或使用Picasa網絡相冊數據API實施解決方案。
您應該指定要接受的輸入類型。 無論出於何種原因,這都會使一切按預期工作。
<input type="file" id="images" multiple accept="image/*" />
使用不同版本的“ Google相冊”應用(例如,Android 8.0上的3.24.0.204162798)在這里也存在同樣的問題。
相應的對話框在意圖上是開放式的,我可以選擇多個圖像,但是只有一個返回到HTML輸入元素。
我正在使用的HTML輸入元素如下:
<input id="file" type="file" accept="image/*" multiple></input>
我很確定HTML代碼正確無誤,並且可以正常工作,請參考:
任何提示表示贊賞!
編輯:
有人知道我可以在哪里提交Google“照片”應用程序的錯誤報告嗎?
accept
屬性非常有用。 它提示瀏覽器僅顯示當前input
允許的文件。 雖然它通常可以被用戶覆蓋,但默認情況下它有助於縮小用戶的結果范圍,因此他們可以准確地獲得他們正在尋找的內容,而無需篩選一百種不同的文件類型。
注意:這些示例是根據當前規范編寫的,可能實際上並不適用於所有(或任何)瀏覽器。 規范也可能在未來發生變化,這可能會破壞這些示例。
<h1>Match all image files (image/*)</h1>
<p><label>image/* <input type="file" accept="image/*"></label></p>
<h1>Match all video files (video/*)</h1>
<p><label>video/* <input type="file" accept="video/*"></label></p>
<h1>Match all audio files (audio/*)</h1>
<p><label>audio/* <input type="file" accept="audio/*"></label></p>
<h1>Match all image files (image/*) and files with the extension ".someext"</h1>
<p><label>.someext,image/* <input type="file" accept=".someext,image/*"></label></p>
<h1>Match all image files (image/*) and video files (video/*)</h1>
<p><label>image/*,video/* <input type="file" accept="image/*,video/*"></label></p>
對於多張圖片上傳
<input type="file" id="deviceCamera" multiple accept="image/*"/>
但是從“移動”(圖像/*)輸入它允許您從Camera
或某些應用程序中進行選擇,但不能從Documents
,並且您無法從中進行多選。
所以現在我只是使用:
<input type="file" multiple accept="image/*,.jpg,.gif,.png,.jpeg"/>
這使我可以從Documents
和Camera
進行選擇,但不能從任何應用程序中進行選擇,但至少Documents
允許您選擇多個圖像。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.