Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts

    16 digit unique number

    hello

    i am doing image upload, thus i want to rename my images, how can i generate 16digit unique number
    flying dagger

  • #2
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    you could use the php function tempnam, which will create a file with a unique filename- though it isnt 16 digits unless you prefix as such: http://uk2.php.net/tempnam

    you could use uniqid() which will generate either a 13 or 23 digit number, and pad or trim as you see fit.

    You could use some function of the current time (microtime()) to produce 16 digits.

    Have you chosen 16 for a reason?
    My thoughts on some things: http://codemeetsmusic.com
    And my scrapbook of cool things: http://gjones.tumblr.com

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts
    i dont want the image name to be too long, at this moment i am able to get 32 unique number
    flying dagger


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •