Closed jfoclpf closed 3 years ago
I had to convert to base64
window.resolveLocalFileSystemURL(imageUri, function (fileEntry) {
fileEntry.file((file) => {
if (!file.size) { console.error('File is empty (on fileEntry from resolveLocalFileSystemURL)'); return }
var reader = new FileReader()
reader.onloadend = () => {
const base64 = 'base64:photo.jpg//` + reader.result.split(',').pop()'
console.log(base64)
}
reader.onerror = (err) => { console.error('Error on FileReader', err) }
reader.readAsDataURL(file)
}, (err) => { console.error('Error on fileEntry.file', err) })
}, (err) => { console.error('Error on resolveLocalFileSystemURL', err) })
As you can see here: https://cordova.apache.org/docs/en/9.x/reference/cordova-plugin-file/#ios-quirks
cordova.file.* properties defined for iOS applicationDirectory and applicationStorageDirectory are read-only.
But for attaching files you demand
which make reference to application directory
How do I attach dynamic created files in iOS if I can't move files to application Directory?
How do you attach files in iOS?