mysql - Undefined index: on uploading an image into database from php

920

Sorry for that question, but I tried everything and i can't solve my problem.

I'm trying to add an image to the database from a form in php and then show the image on the page.

However I am with an error I can't solve.

The error is this:

Does anyone could help me please?

Thanks everyone.

-----index.php

734

Answer

-

    {-code-2}

------get.php-----

   {-code-3}

enter image description here

Line 18:{-code-4}

375

Answer

----EDIT
449

Answer

------

thanks everyone for all sugestions. I tried everything you guys said. And the result was this.

enter image description here

What's going on?

47

Answer

Solution:

You forgot the 't' here.

enctype="mulipart/form-data"

so

enctype="multipart/form-data"

You're also trying to check forisset($_POST['image']) which should beisset($_FILES['image'])

20

Answer

Solution:

apart from typo fix ofmulipart/form-data tomultipart/form-data You need to validate/check it before accessing

if (!empty($_FILES['image']['name'])) {
    $file = $_FILES['image']['tmp_name'];
}

People are also looking for solutions to the problem: PHP show date2 if date1 passed

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.