Uploading file Link in PHP
<p>Sir, I want image uploading system for my users.
I want that image must be uploaded in IMAGE folder and also its location link suppose to be copied in my Mysql database table.
The problem is that image is uploaded in IMAGE folder in dir but in php MYSQL table its link does't get uploaded or copied.</p>

<p>Following are the scripts, Kindly Help to solve this:</p>

<p><strong>Form Page:</strong></p>

<pre><code>&lt;form action="UplaodGallery_script.php" method="post" enctype="multipart/form-data" name="form" id="form"&gt;
                &lt;table width="414" height="78" border="0" align="center" cellpadding="0"&gt;
                  &lt;tr&gt;
                    &lt;td width="111" height="15"&gt;Upload Photo :&lt;/td&gt;
                    &lt;td width="297"&gt;&lt;label for="file"&gt;&lt;/label&gt;
                      &lt;input type="file" name="file" id="file"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;td&gt;Description :&lt;/td&gt;
                    &lt;td&gt;&lt;label for="desc"&gt;&lt;/label&gt;
                      &lt;input type="text" name="desc" id="desc"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                    &lt;td&gt;&lt;p&gt;
                      &lt;input type="submit" name="button" id="button" value="Submit"&gt;
                    &lt;/p&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                &lt;/table&gt;
              &lt;/form&gt;
</code></pre>

<p><strong>UplaodGallery_script.php Page Code</strong></p>

<pre><code>&lt;?php require_once('Connections/conne.php'); ?&gt;
&lt;?php

if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&amp;&amp; ($_FILES["file"]["size"] &lt; 20000000))
  {
  if ($_FILES["file"]["error"] &gt; 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "&lt;br /&gt;";
    }


    if (file_exists("upload/" . $_FILES["file"]["name"]))
      {
      echo $_FILES["file"]["name"] . " already exists. ";
      }
    else
      {
      move_uploaded_file($_FILES["file"]["tmp_name"],
      "upload/" . $_FILES["file"]["name"]);


      }
    }

else
  {
  echo "Invalid file";
  }


$path="upload/" . $_FILES["file"]["name"];
$desc=$_POST["desc"];

mysql_select_db("$database_conne"); 
mysql_query("INSERT INTO photo ('desc', 'photopath') VALUES ('$desc','$path')");

mysql_close ($conne);
?&gt; 
</code></pre>
