Khdemti uses cookies to ensure you get the best experience on our website.
GOT IT
LEARN MORE
ReactJS issue with an Android
Project description

I have several file type inputs to upload images like this:


Quan es puja una nova foto, hi ha un event de tipus 'onChange' per poder fer una previsualització de la imatge abans de pujar-la. Aquest event el defineixo així:

handleBackPreviewImage(e) {
e.preventDefault();

let reader = new FileReader();
let file = e.target.files[0];

if (file && file.type.match('image.*')) {
reader.readAsDataURL(file);
}

reader.onloadend = () => {
this.setState({
imageBackPreviewUrl: reader.result,
backFile: file
});
}


}

Then when uploading the image on an ANDROID mobile, it returns an error like this:


app.bundle.js?v=7:52242 Uncaught TypeError: Failed to execute 'readAsDataURL' on 'FileReader': parameter 1 is not of type 'Blob'.
at RegisterExtraBase.handleBackPreviewImage (app.bundle.js?v=7:52242)
at ConnectedField.handleChange (app.bundle.js?v=7:39886)
at Object.executeOnChange (app.bundle.js?v=7:14654)
at ReactDOMComponent._handleChange (app.bundle.js?v=7:14471)
at Object.ReactErrorUtils.invokeGuardedCallback (app.bundle.js?v=7:6928)
at executeDispatch (app.bundle.js?v=7:6713)
at Object.executeDispatchesInOrder (app.bundle.js?v=7:6736)
at executeDispatchesAndRelease (app.bundle.js?v=7:6134)
at executeDispatchesAndReleaseTopLevel (app.bundle.js?v=7:6145)
at Array.forEach ()

This error only happens when the photo is made through the camera of the mobile device, if it is done from the gallery it works correctly.

Any idea of the problem?


Skills required
React.js

Help us protect you better.

It is forbidden to trade outside the platform! Do not send payments or work outside the site.
SUBMIT A PROPOSAL

Looking to earn money?

  • Set your budget and deadlines
  • Describe your proposal
  • Get paid for your work
CALL FOR PROPOSALS FROM FREELANCES (5)

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: commentStatus

Filename: files/projet_view.php

Line Number: 344

Ouafa Z.
0.0 Marrakech, Morocco
Private amount
Private duration
Hicham E.
0.0 Rabat, Morocco
RESUME 
Private amount
Private duration
Private amount
Private duration
Web T.
0.0 Casablanca, Morocco
Private amount
Private duration
Sneh G.
0.0 Paris, France
Private amount
Private duration
150 - 500
Budget
----
Average proposals
1 days
Mission duration
OPEN MISSION
Mobile Development
Local project
5 Received proposals
1265 views
Cataluna, Spain
PROJECT OWNER
Co. Perception
0.0
Cataluna, Spain
Submit a similar project
  • Publication 100% free
  • Receive 10 quotes on average
  • No commission to pay
Post a mission
Support center