The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

need a little help with this upload code

at the moment peeps who upload a photo gets a time stamp in the name
so the final photo gets time stamp + the original name
can this code be changed so as the photo only has the time stamp as name
cheers
Doug

PHP Code:

$pname= time().'_'.basename( $_FILES['photo']['name']);

//Writes the photo to the server
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target.$pname))

//Tells you if its all ok
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory";

ok changed the code to above and it is still not working as i wanted
ok the photo i uploaded was dog.jpg
the time stamp was added so the photo was named
1248364178_dog.jpg and this was entered in database
i was expecting 1248364178.jpg or is this not possable
cheers
Doug

ok getting totally confused now state of play is now timestamp is working ok
it renames the photo to timestamp.jpg also puts that in database but does not display on web page
here is the full script i have

PHP Code:

//This is the directory where images will be saved
$target = "uploads/";

How does this iamge showing happen on this another page, if the images are not shown ? Yes if you give image name a timestamp then the image is named timestamp.jpg and then you must use this absolutely same name/path to show the image later. Not with new timestamp. I am not really following you... what you try to say?

sorry if i am confusing you
what i ment to say when the photo is up loaded its name is changed to the time stamp or am i wrong
so that in the upload folder the photo would be say 125342653.jpg
and in the database under pname would be the same 125342653.jpg
if you see what i mean
cheers
Doug

And what happens? Does it give any error? Broken image? Absolutely nothing? Have you checked what is inside $info['pname'], is there data that should be there (try with echo, var_dump or print_r)? See also that this image really exists in the hard-drive. Are you absolutely sure the url is correct?