Open Stophface opened 8 months ago
I am trying to upload a rather large file (~100mb) to Dropbox. The response I am getting from rn-fetch-blob is that it worked, however, there is a) nothing in my Dropbox and b) the upload takes about 1sec which is way too short for ~100mb.
const _authenticateDropbox = async () => { const config = { clientId: '...', clientSecret: '... redirectUrl: 'org.reactjs.native.example..../oauth', scopes: [], serviceConfiguration: { authorizationEndpoint: 'https://www.dropbox.com/oauth2/authorize', tokenEndpoint: `https://www.dropbox.com/oauth2/token`, }, additionalParameters: { token_access_type: 'offline', }, }; try { const user = await authorize(config); if (user) { if (user.accessToken) _uploadData(user.accessToken); } } catch (error) { console.warn('Something went wrong logging in into Dropbox, ', error); } }; const _uploadData = accessToken => { const dbName = `${DATABASE_NAME}.db`; const databasePath = `${RNFS.DocumentDirectoryPath}/${dbName}`; RNFetchBlob.fetch( 'POST', 'https://content.dropboxapi.com/2/files/upload', { Authorization: accessToken, 'Dropbox-API-Arg': JSON.stringify({ path: '/foo.db', mode: 'add', autorename: true, mute: false, }), 'Content-Type': 'application/octet-stream', }, RNFetchBlob.wrap(databasePath), ) .uploadProgress({interval: 250}, (written, total) => { ... }) .then(res => { ... }) .catch(error => { ... }); };
Additionally, the total propb of uploadProgress() is 0 all the time. Am I doing something wrong?
total
uploadProgress()
Versions: "react-native": "0.71.7", "rn-fetch-blob": "^0.12.0",
I am trying to upload a rather large file (~100mb) to Dropbox. The response I am getting from rn-fetch-blob is that it worked, however, there is a) nothing in my Dropbox and b) the upload takes about 1sec which is way too short for ~100mb.
Additionally, the
total
propb ofuploadProgress()
is 0 all the time. Am I doing something wrong?Versions: "react-native": "0.71.7", "rn-fetch-blob": "^0.12.0",