Adding generated random number to image name before upload.
I have a cms that uploads data + images to a MySQL database, and I'm trying to add a random number that is generated to the image name before its uploaded.
This is what I have but I'm struggling to add $random1 to the correct bit of the code for it to work.
I have tried to add $random1 all over those scripts and havent worked it out.
$random1 = substr(number_format(time() * rand(),0,'',''),0,10);
$target = "imgdata/stock/";
$target = $target . basename( $_FILES['image1']['name']);
$q=mysql_query("insert into stock (stock_Image) values('imgdata/stock/$pic1')") or die (mysql_error());