Remove a space from image link
<p>I'm currently making an image uploading website: <a href="http://uploadifi.com" rel="nofollow">http://uploadifi.com</a> and I've came to a halt, my problem is when you upload an image with a SPACE in the name, the link it provides is wrong, Example, If you upload Family in spain.png it will only show uploadifi.com/files/family</p>

<pre><code>&lt;?php
//8 Bits= 1 Byte
//1024 Bytes= 1KB
//1024 KB=1 M8
//1024 MB=1GB
//1024 GB=1TB
$allowedExts = array("gif", "jpeg", "jpg", "PNG", "png","rar","zip");
$extension = end(explode(".", $_FILES["file"]["name"]));
if ((($_FILES["file"]["type"] == "image/gif") // .gif 
|| ($_FILES["file"]["type"] == "image/jpeg") // .jpeg
|| ($_FILES["file"]["type"] == "image/jpg") // .jpg
|| ($_FILES["file"]["type"] == "image/jpg") // .jpg 
|| ($_FILES["file"]["type"] == "image/PNG") // .PNG
|| ($_FILES["file"]["type"] == "image/png")
|| ($_FILES["file"]["type"] == "application/x-rar-compressed")
|| ($_FILES["file"]["type"] == "application/zip"))
&amp;&amp; ($_FILES["file"]["size"] &lt; 2000000)
&amp;&amp; in_array($extension, $allowedExts))
{
if ($_FILES["file"]["error"] &gt; 0)
 {
echo "Return Code: " . $_FILES["file"]["error"] . "&lt;br&gt;";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "&lt;br&gt;";
//echo "Type: " . $_FILES["file"]["type"] . "&lt;br&gt;";//Not Needed For Now
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " KB (Do&lt;b&gt; " . ($_FILES["file"]["size"] / 1024) . " / 1024&lt;/b&gt; **CLOSE BUT NOT ACCURATE**)&lt;br&gt;";

if (file_exists("files/" . $_FILES["file"]["name"]))
  {
  echo $_FILES["file"]["name"] . " already exists. Please change file name and try again. ";
  }
else
  {
  move_uploaded_file($_FILES["file"]["tmp_name"],
  "files/" . $_FILES["file"]["name"]);
  echo "Stored in: " . "&lt;a href=\ffiles/" . $_FILES["file"]["name"] . "&gt; ". $_FILES["file"]["name"] ." &lt;/a&gt;";
  echo "&lt;br&gt;&lt;b&gt;If the above link does not work; please make sure your uploaded&lt;br&gt;file does not have any spaces in the name.&lt;br&gt; IE 'Hello There' make sure it is 'hellothere'.&lt;/b&gt;";
  }
}
}
else
{
 echo "Invalid file";
  }
?&gt; 
</code></pre>

<p>I want to when the image is uploaded it puts a '_' where the space is supposed to be. Or even better if possible; it generates a random lettered name (which ever is easier of course.)</p>

<p>**The only reason I 'reposted' this was I couldn't actually get a solution from the other question. Sorry if that was against the rules. </p>
