5

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]);
 }
1
  • Do you have any database storages like Firebase Storage? Commented Mar 14, 2020 at 1:06

1 Answer 1

2

This 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 compatibility. See the below compatibility chart to see if your browser supports the feature:

https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL#Browser_compatibility

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.