File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { AppwriteException, Client } from '../client';
33import type { Models } from '../models' ;
44import type { UploadProgress , Payload } from '../client' ;
55import * as FileSystem from 'expo-file-system' ;
6+ import * as Device from 'expo-device'
67
78export class Storage extends Service {
89
@@ -139,8 +140,12 @@ export class Storage extends Service {
139140 position : offset ,
140141 length : Service . CHUNK_SIZE
141142 } ) ;
142-
143- payload [ 'file' ] = { uri : `data:${ file . type } ;base64,${ chunk } ` , name : file . name , type : file . type } ;
143+ var path = `data:${ file . type } ;base64,${ chunk } ` ;
144+ if ( Device . osName == 'Android' ) {
145+ path = FileSystem . cacheDirectory + '/tmp_chunk' ;
146+ await FileSystem . writeAsStringAsync ( path , chunk , { encoding : FileSystem . EncodingType . Base64 } ) ;
147+ }
148+ payload [ 'file' ] = { uri : path , name : file . name , type : file . type } ;
144149 response = await this . client . call ( 'post' , uri , apiHeaders , payload ) ;
145150
146151 if ( onProgress ) {
You can’t perform that action at this time.
0 commit comments