PHP - Image uploading not working
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/11785726/image-uploading-via-php-returning-empty-array">Image uploading via PHP returning empty array</a>  </p>
</blockquote>



<p>I am unable to successfully upload an image/file to my server. The php is as follows:</p>

<pre><code>//This is the directory where images will be saved
$uploadDir = "./";
$uploadFile = $uploadDir . basename( $_FILES['photo']['name']);

//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $uploadFile)){
    echo "The file has been uploaded successfully.";
} else {
    print_r($_FILES);
}
</code></pre>

<p>I chose the directory at which this script lives, to ensure the functionality before I upload to the final directory. I want to upload photo's, and will check for file extensions later - but for now I at least need the upload functionality to work.</p>

<p>The form is as follows:</p>

<pre><code>&lt;form id="imageUploadForm" name="imageForm" enctype="multipart/form-data" action="imageController.php" method="post"&gt;
&lt;label for="photo" class="blogLabel"&gt;Upload an Image&lt;/label&gt;
&lt;input type="file" name="photo" id="imageUpload"&gt;
&lt;input type="submit" name="submit" id="imageSubmit" class="btn btn-primary" value="Upload"&gt;
&lt;/form&gt;
</code></pre>

<p><code>print_r($_FILES)</code> returns: <code>Array ( [photo] =&gt; Array ( [name] =&gt; imgres.jpeg [type] =&gt; image/jpeg [tmp_name] =&gt; /tmp/php1rqFUO [error] =&gt; 0 [size] =&gt; 15147 ) )</code></p>
