2

How I said in the title I am trying to upload an image with js/jquery but I do not know how to take the image to send it to server (PHP). I have a form with all the information that I want and then with jquery i take all this information to save it in MySql. I tried to get an object with the image attributes but got this error:

I am doing something wrong or maybe I need something else...?

Sorry for my bad English.

enter image description here enter image description here

2
  • This is almost certainly caused by your data not being in the correct format...jsonp in this case. Commented Dec 6, 2018 at 19:02
  • Try data: formData, Commented Dec 6, 2018 at 19:04

1 Answer 1

1

An easy way to do that is by using the following plugin that allows you to have some upload progressbar as well (in case you boss needs more ui).

An another approach is to read the file's contents as seen in this link, and convert it as base64 as seen in this question's answers.

An another approach is by looking this answer as well.

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.