I have an HTML form where there is a pdf file attachment field() at last, I make a post request with all the field form data
when and select to field android file picker opens
PS: I have managed to show a message to the user if selected from google drive that please select from storage but I don't want that I want to actually be able to post the file with the attachment
As explained in comments, it's a bug with Chrome (https://bugs.chromium.org/p/chromium/issues/detail?id=1063576).
The following error can also be raised: NotReadableError: The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired..
As a workaround, clone your File or Blob before further use:
const buffer = await file.arrayBuffer();
const clone = new File([buffer], file.name, { type: file.type });
const buffer = await file.arrayBuffer();
const clone = new File([buffer],file.name, { type: file.type });
let FD = new FormData();
FD.append('uploaded_file', clone);
And use FD wherever required.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With