I have this loadfile function that loads an image after uploading.. I want to convert to get its URL path... but im receiving an error "URL.createObjectURL is not a function" but when i console the e.target.files[0], I can view the file in console.. can any one help me?
loadFile: function(e){
var output = document.getElementById('output');
output.src = URL.createObjectURL(e.target.files[0]);
}
I have this loadfile function that loads an image after uploading.. I want to convert to get its URL path... but im receiving an error "URL.createObjectURL is not a function" but when i console the e.target.files[0], I can view the file in console.. can any one help me?
loadFile: function(e){
var output = document.getElementById('output');
output.src = URL.createObjectURL(e.target.files[0]);
}
Share
Improve this question
asked May 13, 2016 at 10:23
trebtreb
5481 gold badge7 silver badges16 bronze badges
1
- Do you have any database storages like Firebase Storage? – Ragul CS Commented Mar 14, 2020 at 1:06
1 Answer
Reset to default 2This most definitely is unrelated to react. The reason you're likely experiencing this is the createObjectURL is still a part of a working draft and has not yet been finalized, and as such you won't have much browser patibility. See the below patibility chart to see if your browser supports the feature:
https://developer.mozilla/en-US/docs/Web/API/URL/createObjectURL#Browser_patibility