Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ const options = {
// Below are options only supported on Android
notification: {
enabled: true
}
},
useUtf8Charset: true
}

Upload.startUpload(options).then((uploadId) => {
Expand Down Expand Up @@ -154,6 +155,7 @@ Returns a promise with the string ID of the upload. Will reject if there is a c
|`field`|string|Required if `type: 'multipart'`||The form field name for the file. Only used when `type: 'multipart`|`uploaded-file`|
|`parameters`|object|Optional||Additional form fields to include in the HTTP request. Only used when `type: 'multipart`||
|`notification`|Notification object (see below)|Optional||Android only. |`{ enabled: true, onProgressTitle: "Uploading...", autoClear: true }`|
|`useUtf8Charset`|boolean|Optional||Android only. Set to true to use `utf-8` as charset. ||

### Notification Object (Android Only)
|Name|Type|Required|Description|Example|
Expand Down
10 changes: 8 additions & 2 deletions android/src/main/java/com/vydia/UploaderModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,14 @@ public void onCancelled(Context context, UploadInfo uploadInfo) {
return;
}

request = new MultipartUploadRequest(this.getReactApplicationContext(), customUploadId, url)
.addFileToUpload(filePath, options.getString("field"));
if(options.hasKey("useUtf8Charset") && options.getBoolean("useUtf8Charset")) {
request = new MultipartUploadRequest(this.getReactApplicationContext(), customUploadId, url)
.setUtf8Charset()
.addFileToUpload(filePath, options.getString("field"));
} else {
request = new MultipartUploadRequest(this.getReactApplicationContext(), customUploadId, url)
.addFileToUpload(filePath, options.getString("field"));
}
}


Expand Down