Error while uploading file in PHP
<p>While uploading the file in php i am not able to upload all types of file, if any space is there in between file name that is not able to download. Please can anyone correct this code</p>

<p>here is my upload code</p>

<pre><code>&lt;?php

$target_path = "../mt/sites/default/files/ourfiles/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
    " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}



$con = mysql_connect("localhost","mt","mt");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }else{
 echo "Connected";
}

// Create table
mysql_select_db("mt", $con);

mysql_query("INSERT INTO mt_upload (FileName, FilePath)
VALUES ('".basename( $_FILES['uploadedfile']['name'])."', '".$target_path.basename( $_FILES['uploadedfile']['name'])."')");


// Execute query
mysql_query($sql,$con);

mysql_close($con);



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