Function doesn't move image but returns info correctly
<p>I'm tryin to upload 2 images but it seems all to be well but it move_uploaded_file() doesn't move the file, no errors have been generated.</p>

<pre><code>// Upload Image
function upload_image($tmp,$name) {
    $ext = explode('.',$name);
    if (preg_match('~(jpeg|jpg|gif|png)$~i', $name)) {
    $ext = end($ext);

    $name = substr(md5(rand()), 0, 10).'.' . $ext;
    $upload_dir = '/music/uploads/' . $name;
    echo $tmp;
    move_uploaded_file($tmp,'/home/shadne/public_html'.$upload_dir);

        return $upload_dir;
    } else {
        throw new ErrorException('File type not allowed');
    }
}
</code></pre>

<p>file/folder permission is 0777, i used images/new before using /uploads</p>

<p>EDIT 1</p>

<p>code that handles the uploading and checkin</p>

<pre><code>&lt;?php
require_once '../config.php';
require 'includes/functions.php';

if (!empty($_FILES['artist_profile_image'])) {
    $profile_image_name = $_FILES['artist_profile_image']['name'];
    $profile_image_tmp = $_FILES['artist_profile_image']['tmp'];
    $profile_image_dir = upload_image($profile_image_tmp, $profile_image_name);
}

if (!empty($_FILES['artist_thumb'])) {
    $thumb_name = $_FILES['artist_thumb']['name'];
    $thumb_tmp = $_FILES['artist_thumb']['tmp'];
    $thumb_dir = upload_image($thumb_tmp, $thumb_name);
}

if (empty($_POST) === false) {
    $required_fields = array('artist_name', 'artist_thumb', 'artist_profile_image', 'birthday');
    foreach ($_POST as $key =&gt; $value) {
            if (empty($value) &amp;&amp; in_array($key, $required_fields) === true) {
                $errors[] = 'Fields marked with an asterstrik are required';
                break 1;
            }
    }
}

if (isset($_GET['success'])) {
    echo 'You\'ve added a new artist.';
} else {
    if (empty($_POST) === false &amp;&amp; empty($errors) === true) {
        $artist_data = array(
            'artist_name'           =&gt; $_POST['artist_name'],
            'artist_thumb'          =&gt; $thumb_dir,
            'artist_profile_image'  =&gt;  $profile_image_dir,
            'birthday'              =&gt; $_POST['birthday'],
        );

        add_artist($artist_data);
        //exit(header('Location: add_artist.php?success'));

    } else if (empty($errors) === false) {
        echo output_errors($errors);
    }
?&gt;
&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;
    &lt;head&gt;
        &lt;meta charset="utf-8" /&gt;
        &lt;title&gt;Admin Area&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;

&lt;h1&gt;Add Artist&lt;/h1&gt;

&lt;form action="" method="post" enctype="multipart/form-data"&gt;
    &lt;ul&gt;
        &lt;li&gt;
            Artist Name*: &lt;input type="text" name="artist_name" /&gt;
        &lt;/li&gt;
        &lt;li&gt;
            Artist Thumbnail*: &lt;input type="file" name="artist_thumb" /&gt;
        &lt;/li&gt;
        &lt;li&gt;
            Artist Profile Image*: &lt;input type="file" name="artist_profile_image" /&gt;
        &lt;/li&gt;
        &lt;li&gt;
            Birthday*:
                    &lt;input type="date" name="birthday" /&gt;
        &lt;/li&gt;                    
        &lt;li&gt;
        &lt;input type="submit" value="Add Artist" /&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
&lt;/form&gt;
&lt;?php  } ?&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
