title: How do I randomize the name of an uploaded image
body: <pre><code>if( isset($_POST["Headline"]) &amp;&amp; isset( $_POST["Summary"]) &amp;&amp; isset( $_POST["Description"])&amp;&amp; isset( $_POST["submit"]) )  {
      $Headline = $_POST['Headline'];
  
      $Summary = $_POST['Summary'];
      $Description= $_POST['Description'];
  
      $image_file = $_FILES["txt_file"]["name"];
      $type  = $_FILES["txt_file"]["type"]; //file name "txt_file" 
      $size  = $_FILES["txt_file"]["size"];
      $temp  = $_FILES["txt_file"]["tmp_name"];
  
      $path="Images/".$image_file; //set upload folder path
  
      if(empty($Headline )) {
              echo '&lt;script language="javascript"&gt;';
              echo 'alert("Please Enter a Headline")';
              echo '&lt;/script&gt;';
      }
      else if(empty($Summary)) {
              echo '&lt;script language="javascript"&gt;';
              echo 'alert("Please Enter a Summary")';
              echo '&lt;/script&gt;';
      }
      else if(empty($Description)) {
              echo '&lt;script language="javascript"&gt;';
              echo 'alert("Please Enter a Description")';
              echo '&lt;/script&gt;';
      }        
      else if(empty($image_file)) {
              echo '&lt;script language="javascript"&gt;';
              echo 'alert("Please upload an image")';
              echo '&lt;/script&gt;';
      }
      else if ($type=="image/jpg" || $type=='image/jpeg' || $type=='image/png' || $type=='image/gif') {
               if(!file_exists($path)) //check file not exist in your upload folder path
                     {
                      move_uploaded_file($temp, "Images/" .$image_file);
                   in here is where the image gets sent to the folder but how do i make it so it is randomized    
  
                      $query = $con-&gt; prepare("
          INSERT INTO News ( Headline, Summary,Description, Image,Date)
          VALUES ( :Headline, :Summary,:Description, '".$_FILES['txt_file']['name']."'  , NOW() )
  
          ");
  
      $success = $query-&gt; execute ([
              'Headline' =&gt; $Headline,
              'Description' =&gt; $Description,
              'Summary' =&gt; $Summary,
          ]);
  }
  </code></pre>
  
  <p>I want the name of the image to ideally be different every time so when a user uploads an image with the same name there's no overwriting of already existing images</p>