php file submission failed
<p>I used the codes(html+php script) below to upload image file </p>

<p>submit.html</p>

<pre><code>&lt;html&gt; 
&lt;body&gt; 

&lt;form action="upload_file.php" method="post"
enctype="multipart/form-data"&gt; 
&lt;label for="file"&gt;Filename:&lt;/label&gt; 
&lt;input type="file" name="file" id="file" /&gt; 
&lt;br /&gt; 
&lt;input type="submit" name="submit" value="Submit" /&gt; 
&lt;/form&gt; 

&lt;/body&gt; 
&lt;/html&gt;
</code></pre>

<p>php upload file upload_file.php</p>

<pre><code>&lt;?php

echo $_FILES["file"]["type"] ;

echo  "&lt;br&gt;";
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&amp;&amp; ($_FILES["file"]["size"] &lt; 20000))
  {
  if ($_FILES["file"]["error"] &gt; 0)
    {
    echo "Return Code: " . $_FILES["file"]["error"] . "&lt;br /&gt;";
    }
  else
    {
    echo "Upload: " . $_FILES["file"]["name"] . "&lt;br /&gt;";
    echo "Type: " . $_FILES["file"]["type"] . "&lt;br /&gt;";
    echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb&lt;br /&gt;";
    echo "Temp file: " . $_FILES["file"]["tmp_name"] . "&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"]);
      echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
      }
    }
  }
else
  {
  echo "Invalid file";
  }
?&gt;
</code></pre>

<p>but it reported error:</p>

<pre><code>image/jpeg
Upload: 02.jpg
Type: image/jpeg
Size: 54.2626953125 Kb
Temp file: /tmp/phpT617qx

Warning: move_uploaded_file(upload/02.jpg): failed to open stream: No such file or directory in /home/virtual/site18/fst/var/www/html/test/upload_file.php on line 29

Warning: move_uploaded_file(): Unable to move '/tmp/phpT617qx' to 'upload/02.jpg' in /home/virtual/site18/fst/var/www/html/test/upload_file.php on line 29
Stored in: upload/02.jpg
</code></pre>

<p>submit.html and upload_file.php are in same directory with mod 777</p>

<p>Welcome any comment</p>
