我有一個需要上傳到服務器的檔案的串列。上傳函式有一個回呼,用于指示上傳完成的時間。我怎樣才能按順序上傳串列中的每個檔案,直到所有檔案都被上傳?
//我的檔案串列。
List<File> _list;
//該上傳函式接受一個單一的檔案并有一個onComplete函式。
upload(_list.first, (){
//Now I need to trigger an upload of the second file in the list and so on until all tasks have been uploaded.
});
我怎樣才能讓檔案按順序上傳?
謝謝你的幫助。
謝謝你的幫助。
uj5u.com熱心網友回復:
怎么樣:
void uploadAll(List< File> files) {
int cursor = 0;
void uploadNext() {
if (cursor == values.length) return;
upload(values[cursor ], uploadNext)。
}
uploadNext()。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/327363.html
標籤:
上一篇:使用ReactNative的DialogFlow-CX
下一篇:如何使用LOOP重組資料框架
