Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
04-06-2003, 05:06 PM #1
- 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.
04-06-2003, 05:43 PM #2
- Join Date
- May 2002
- Perth Australia
- Thanked 93 Times in 91 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
$res=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.
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)