1

その中にサンドボックス化されたセクションがあるChromeパッケージアプリに取り組んでいます。

サンドボックスでボタンがクリックされるpostMessageと、ファイル ダイアログ input を開くためのコマンドを含むメッセージがメイン アプリケーションに渡されます(chrome.fileSystem.chooseEntry [type="openFile"]

すべてがうまく機能しますが、ファイル ダイアログで複数選択を有効にするための解決策が見つかりません。

現在、一度に 1 つのファイルしか選択および選択できません。

私が見逃した属性があることを願っています...

編集:

解決策 - 受け入れる複数: true

chrome.fileSystem.chooseEntry({type: 'openFile', acceptsMultiple: true, accepts: accepts}, function(entry) { ... });
4

2 に答える 2

1

Chrome 30以降は可能です。使用方法の例を次に示します。

chrome.fileSystem.chooseEntry({type: 'openFile', accepts: extensionFilter , acceptsMultiple: true }, function(theEntry, fileEntries) {

var fileCount = theEntry.length;
console.log("fileCount = " + fileCount );

// use local storage to retain access to this file
chrome.storage.local.set({'chosenFile': chrome.fileSystem.retainEntry(theEntry[0])});

for (var i = 0; i < fileCount; i++) {
    chrome.fileSystem.getDisplayPath(theEntry[i], function(path) {
         console.log( path );
    });
}

});
于 2015-08-13T13:11:50.763 に答える
0

chrome.fileSystem.chooseEntryメソッドは、単一のファイルでのみ機能します。コールバックは単一のfileEntryを返します。https://code.google.com/p/chromium/issues/detail?id=159062にスターを付けることをお勧めします。これは、複数ファイル機能の追加を提案しています。

于 2013-03-20T19:45:43.150 に答える