php random image file name
<p>Okay im using a snippet I found on google to take a users uploaded image and put it in my directory under Content</p>

<p>But Im worried about duplicates so I was going have it upload the image as a Random number </p>

<p>well here is my code you can probably understand what im going for through it anyways</p>

<pre><code>&lt;label for="file"&gt;Profile Pic:&lt;/label&gt; &lt;input type="file" name="ProfilePic" id="ProfilePic" /&gt;&lt;br /&gt;

&lt;input type="submit" name="submit" value="Submit" /&gt;

$ProfilePicName = $_FILES["ProfilePic"]["name"];
$ProfilePicType = $_FILES["ProfilePic"]["type"];
$ProfilePicSize = $_FILES["ProfilePic"]["size"];
$ProfilePicTemp = $_FILES["ProfilePic"]["tmp_name"];
$ProfilePicError = $_FILES["ProfilePic"]["error"];

$RandomAccountNumber = mt_rand(1, 99999);  
echo $RandomAccountNumber; 
move_uploaded_file($ProfilePicTemp, "Content/".$RandomAccountNumber.$ProfilePicType);
</code></pre>

<p>And then basicly after all this Im going try to get it to put that random number in my database </p>

<p>Someone gave me a new snippet that looks like it will do what I want but now the file isnt making it all the way to my directory </p>

<pre><code>$RandomAccountNumber = uniqid();
echo $RandomAccountNumber;

move_uploaded_file($ProfilePicName,"Content/".$RandomAccountNumber);
</code></pre>
