Uncaught Typeerror: Cannot Read Property '0' Of Undefined
Solution 1:
Instead of $('#image_form')[0].files[0]; try with $('#image_form').prop('files')[0];
It worked for me.
Solution 2:
In jQuery, using an id selector (such as (Forget that, an id selector will always yield a collection no matter how many items there are - Thanks Leo for bringing it up.) Moreover, it has no property $('#image_form')) will only yield the first result, so the [0] next to it is unneeded.files, which will yield yet another error.
What do you want to achieve here?
Solution 3:
your problem lies in the files[0] I believe. perhaps you are trying to get the value in the input field? you're acquiring a jquery set of the firm, on which the files property is undefined. $("#image_form").find("input").val() should give you the input box value, though there may be a more appropriate way when dealing with forms
Post a Comment for "Uncaught Typeerror: Cannot Read Property '0' Of Undefined"