Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Milwaukee, Wisconsin
    Thanked 0 Times in 0 Posts

    making a random and unique file name???

    im making an uploadingsystem for my staff and i was wondering how you ould make an image file have a unique number name alos so that it has that same name in a databasa...

    im not sure if i made that clear enough if not just ask ill give more detail.

  • #2
    Super Moderator
    Join Date
    May 2002
    Perth Australia
    Thanked 101 Times in 99 Posts
    If your database table has a unique index then you can name the image using that index.... eg

    again assuming there is an autoindexed field in your table
    PHP Code:
    =mysql_query("INSERT INTO $table ($fields)VALUES($values)");

    now $im_name contains the 'id' of your insert and you can name the image with that.

    else look at http://www.php.net/uniqid which will create a unique ID for you.
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


    Posting Permissions

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