Skip to content
Advertisement

php random image file name

Okay im using a snippet I found on google to take a users uploaded image and put it in my directory under Content

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

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

JavaScript

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

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

JavaScript

Advertisement

Answer

try using the php uniqid method to generate the unique id you need

http://php.net/manual/en/function.uniqid.php

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement