Hi there, you could grab the whole file name from db, form, etc... strip it down to the '.jpg' , concatenate $IDNUMBER . $NUMBER OF PICTURE , then rename it using the combination of $IDNUMBER . $NUMBER OF PICTURE .
<?php $myfile = 'webgraphic.jpg'; $IDNUMBER = 55; $NUMBEROFPICTURE = 999; if(isset($myfile)){ $newfilename = $IDNUMBER . $NUMBEROFPICTURE ; //grab the dot and the file extension $myfile = substr($myfile, -4); $myfile = $newfilename . $myfile; echo $myfile; //upload process follows } ?> Jose Maria Sala <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi php developers: > > I have created a website for a house renting company with an administration > tool. Using this tool, managers can add, modify and delete data in a mysql > database. > > They can also upload some pictures of the houses they rent. The way i do > this is by taking them to the list of houses, making them select one and > next they go to a form. In this form they upload files to a certain folder > in the server. > > What i would like to do is auto rename the file with a name composed by > IDNUMBER + NUMBER OF PICTURE (ex. if ID of that house is 345 image name > would be 34501.gif, 34502.gif, 34503.gif,...) > > I think you got the idea. Any help would be greatly appreciated. > > thx in advance > > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]