I have an HTML form in my website and there is one file upload field in that form. When this form is submitted, I want to upload the selected file to the server and save it in the database. I have done the php part of uploading a file but I can not figure out the way how to send my file to that api that I created? I tried doing this:
var myFile = $("#picture_field").files[0];
and then send this variable as a parameter of my ajax request but I get the error which says:
TypeError: $(...).files is undefined