I need a very small help. NO high ballers please as this is a very very small job.
I don't need you to do anything, I just need you to tell me what to do and I will do it myself.
here is the exact details:
I have a PHP code that will allow me to upload images onto my server and it will renames the files so they won't overwrite each other.
I need to know how I can save the renamed files name on the mysql databse.
here is my PHP code:
function findexts ($filename)
$filename = strtolower($filename) ;
$exts = split("[/\\.]", $filename) ;
$n = count($exts)-1;
$exts = $exts[$n];
//This gets al=$_POST['vehichle'];l the other information from the form
// Connects to your Database
mysql_connect("localhost", "myUsername", "pass") or die(mysql_error()) ;
mysql_select_db("databaseName") or die(mysql_error()) ;
//This applies the function to our file
$ext = findexts ($_FILES['uploaded']['name']) ;
//This line assigns a random number to a variable. You could also use a timestamp here if you prefer.
$ran = rand () ;
//This takes the random number (or timestamp) you generated and adds a . on the end, so it is ready of the file extension to be appended.
$ran2 = $ran.".";
//This assigns the subdirectory you want to save into... make sure it exists!
$target = "images22/";
//This combines the directory, the random file name, and the extension
$target = $target. $ran2.$ext;
echo "The file has been uploaded as ".$ran2.$ext;
echo "Sorry, there was a problem uploading your file.";
//Writes the information to the database
mysql_query("INSERT INTO `employees` VALUES ('$vehichle_name', '$vehichle', '$contact', '$upload')") ;
at the moment the script above will upload the image and renames it and saves it in folder images22 successfuly.
i.e. Uploades [url removed, login to view] and gives it a random name like [url removed, login to view] and saves as as 234523123123.png. this is well and good but when I look into my databse it showes the image with its original name which is [url removed, login to view] instead of [url removed, login to view]!!
can someone please help me with this as I have been trying to do this for 2 days with no avail.
30 freelancers are bidding on average $30 for this job