Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7858407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:25:20+00:00 2026-06-02T21:25:20+00:00

Uploading an image into a directory, it seems to always try upload which is

  • 0

Uploading an image into a directory, it seems to always try upload “” which is nothing. Rather then an actual image. What am I doing below. I know the value is “” because of what it inserts into the database.

<li class="formProductImage">
<span>Image:</span>
<input type="file" name="productImage" /> 
</li>

and the php:

if ($_FILES["productImage"]["error"] > 0)
    {
        echo "Return Code: " . $_FILES["productImage"]["error"] . "<br />";
    }
else
    {
    echo "Upload: " . $_FILES["productImage"]["name"] . "<br />";
    echo "Type: " . $_FILES["productImage"]["type"] . "<br />";
    echo "Size: " . ($_FILES["productImage"]["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $_FILES["productImage"]["tmp_name"] . "<br />";
    $filename = mysql_real_escape_string($_FILES['productImage']['name']);

      $query = "UPDATE products SET image = '$filename' WHERE name = '$name'";
      $result = mysql_query($query);

        if (mysql_affected_rows() == 1) {
            // Show thank you message
            echo '<span style="color:green;">Your image was added to database correctly.</span>';

            if (file_exists("uploaded/" . $_FILES["productImage"]["name"]))
            {
                echo $_FILES["productImage"]["name"] . " already exists. ";
            }
            else
            {
                move_uploaded_file($_FILES["productImage"]["tmp_name"],
                "uploaded/" . $_FILES["productImage"]["name"]);
                echo "Stored in: " . "uploaded/" . $_FILES["productImage"]["name"];
            }

        } else {
            echo '<font color="red">Image note inserted into database.</font>';
            echo mysql_error();
        }

    }
                    }

                        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T21:25:23+00:00Added an answer on June 2, 2026 at 9:25 pm

    Make sure you have enctype="multipart/form-data" in the <form> tag.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

.I have the following codes for uploading an image into a server directory, what
when I am uploading an image into serverside, and saved in a specific folder.
Instead of uploading image one by one, how do i achieve to upload all
I have an image uploading script in which i use the following setup to
So i'm uploading any image file via my great upload form and it uploads
I am building an image uploading website. Images are uploaded to a directory on
i'm building a simple school portal, i have stucked at uploading an image into
I want to upload image file into couchdb using javascript. For this i am
I have used the following code before uploading an image into mysql database Before
I am very new to grails.I am doing one sample project for image uploading

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.