PHP script for upload
<p>I have written a script in PHP which is supposed to enable yuo to upload files. However, it can't seem to move the file to the right folder after it has uploaded it. Can anyone see what the problem is?</p>

<p>Here is the code:</p>

<pre>
    <code>

    echo 'This is upload.php';
    $target_path = 'wwwroot/rsfleet.co.uk/ipad_test/sub/';
    echo 'Size of file: ';
    echo $_FILES['userfile']['size'];
    $target_path = $target_path . basename($_FILES['userfile']['name']);
    echo $target_path; 
    if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
        echo 'File uploaded OK.';
    } else {
        echo 'Problem with file upload.';
    }
    if (move_uploaded_file(basename($_FILES['userfile']['tmp_name']), $target_path)) {
        echo 'The file ' . basename($_FILES['userfile']['name']) . ' has been moved';
    } 
    else 
    {
        echo 'Error moving file. Please try again.';
    }
    echo 'End of page.';

    </code>
</pre>
