Hello,
I have been trying to set up this script for a charity website (animal sanctuary) in which members can upload a photo of their pets to the members log in area.
I have so far managed to get the basic script working but would like to give each image uploaded a unique ID.
Does anyone know how to do this?
This is my script that processes the upload:
<?php
$rank_check = 1;
$page_title = "User Profile";
include "header.inc.php";
print"$openHTML";
//This is the directory where images will be saved
$target = "photos/";
$target = $target . basename( $_FILES['photo']['name']);
//This gets all the other information from the form
$name=$_POST['name'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$pic=($_FILES['photo']['name']);
$user_id=$_POST['user_id'];
$profile_id=$_POST['profile_id'];
$selected=$_POST['selected'];
//Writes the information to the database
mysql_query("INSERT INTO `employees` VALUES ('$name', '$user_id', '$profile_id', '$selected','$email', '$phone', '$pic')") ;
//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{
//Tells you if its all ok
echo "<center>The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory.<p><center>Please click <a href=$base_url/user_photogallery.php?game=$game&user=$username>here</a> to go back to your photo edit page!";
}
else {
//Gives an error if its not
echo "Sorry, there was a problem uploading your file.";
}
?>
Would be grateful for any advice or help
Thank you