title: How to change image name and put "-" in place of space, while uploading it.
body: <p>I am using this code to upload images with PHP </p>
  
  <pre><code>&lt;form action="upload.php" method="post" enctype="multipart/form-data"&gt;
  Select image to upload:
  &lt;input type="file" name="fileToUpload" id="fileToUpload"&gt;
  &lt;input type="submit" value="Upload Image" name="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php
  $target_dir = "uploads/";
  $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
  $uploadOk = 1;
  $imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
  
  
  
  if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], 
  $target_file)) {
      echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
  } else {
      echo "Sorry, there was an error uploading your file.";
  }
  } 
  ?&gt;
  </code></pre>
  
  <p>I want this: If I upload a image named "New York.jpg", the name gets changed to "New-York.jpg"</p>