Error Uploading Images to my server
<p>I'm trying to upload an image to my server as follow:</p>

<p>HTML CODE</p>

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


&lt;form enctype="multipart/form-data" action="uploadimages.php" method="POST"&gt;

&lt;input type="hidden" name="MAX_FILE_SIZE" value="3000000" /&gt;

Send this file: &lt;input name="userfile" type="file" /&gt;
&lt;input type="submit" value="Send File" /&gt;
&lt;/form&gt;

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

<p>Here is the uploadimages.php code:
I also tried with: $uploaddir = '/var/www/html/images/'; and have the same issue.</p>

<pre><code>&lt;?php

$uploaddir = 'http://localhost/images/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '&lt;pre&gt;';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "&lt;/pre&gt;";

?&gt;
</code></pre>

<p>But when I click the button to send file I get the following screen:</p>

<p><a href="https://i.stack.imgur.com/iCuUE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iCuUE.png" alt="enter image description here"></a></p>

<p>Thank you for your help</p>

<p><strong>UPDATE:</strong></p>

<p>So I changed:     </p>

<pre><code>&lt;form enctype="multipart/form-data" action="uploadimages.php" method="POST"&gt;
</code></pre>

<p>to     </p>

<pre><code>   &lt;form enctype="multipart/form-data" action="http://localhost/uploadimages.php" method="POST"&gt;
</code></pre>

<p>Now I get this error:</p>

<p><a href="https://i.stack.imgur.com/s5oHj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s5oHj.png" alt="enter image description here"></a></p>