I have created an image upload page, everything is working fine for one
What I want to do is rename the file that has been uploaded, does anybody know how I can do this.
Here is the code I am using
[php]
<?php if($_POST['upload']) { # edit # $maxwidth = 350; $maxheight = 250; $max_filesize = 102400; $uploads = 'uploads/a001'; $types_array = array('image/gif','image/pjpeg','image/x-png'); # end edit # if($_FILES['image']['name'] == "") { echo "Please select a file to upload!n"; exit; } if(!in_array($_FILES['image']['type'], $types_array)) { echo "That file type is not allowed!n"; exit; } $max_filesize_kb = ($max_filesize / 1024); if($_FILES['image']['size'] > $max_filesize) { echo "You file is too large, files may be up to ".$max_filesize_kb."kbn"; exit; } $imagesize = getimagesize($_FILES['image']['tmp_name']); $imagewidth = $imagesize[0]; $imageheight = $imagesize[1]; if($imagewidth > $maxwidth || $imageheight > $maxheight) { echo "You file is too large, files may be up to ".$maxwidth."px x ".$maxheight."px in sizen"; exit; } move_uploaded_file($_FILES['image']['tmp_name'], $uploads.'/'.$_FILES['image']['name']) or die ("Couldn't upload ".$_FILES['image']['name']."n"); } ?>[/php]
and in the body tags
[php]
[/php]