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
2 changes: 1 addition & 1 deletion packages/capacitor-plugin/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ repositories {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.aar', '*.jar'])
implementation project(':capacitor-android')
implementation "io.ionic.libs:ionfiletransfer-android:1.0.0"
implementation "io.ionic.libs:ionfiletransfer-android:1.0.1"
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"

testImplementation "junit:junit:$junitVersion"
Expand Down
25 changes: 1 addition & 24 deletions packages/example-app/src/js/file-transfer-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,30 +336,7 @@ window.customElements.define(
const uploadProgressContainer = this.shadowRoot.querySelector('#uploadProgressContainer');
uploadProgressContainer.style.display = uploadProgress.checked ? 'block' : 'none';

let filePath;

if (Capacitor.getPlatform() === 'web') {
filePath = file.name;
} else {
const base64 = await new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
const result = reader.result;
resolve(result.split(',')[1]);
};
reader.onerror = reject;
reader.readAsDataURL(file);
});

const savedFile = await Filesystem.writeFile({
path: file.name,
data: base64,
directory: Directory.Cache,
});

filePath = await savedFile.uri;
}

let filePath = file.name;
// Upload file
const result = await FileTransfer.uploadFile({
url,
Expand Down
Loading