title: Generate a random value every time for my website
body: <p>I'm uploading files to a site for our company using CGI.  In the admin panel, employees can upload images to correspond to a specific object that is later stored in JSON.  All of this works, but if Employee A uploads <code>dog.png</code> and then Employee B uploads <code>dog.png</code>.  Employee B's picture will override Employee A's picture and both will reference the same picture.  I thought about getting a hash of the image and naming it it's own hash, problem is, reading the file prior to upload is a bit sketchy with browser support (security issues) and saving it to the server, getting the hash, re-saving, and then deleting the old file is slow and hacked up.</p>
  
  <p><strong>My Question</strong></p>
  
  <p>With this in mind, what is the best way to give each file a unique name?  The name of the file doesn't matter at all, as long as it follows saving conventions (i.e. no <code>/</code> or <code>.</code>).  I also have to be able to generate the name before the file is uploaded.</p>
  
  <p><strong>What I Am Currently Using</strong></p>
  
  <ul>
  <li>JQuery</li>
  <li>Javascript</li>
  <li>CGI (Python)</li>
  </ul>