Hey all, i need some help 🙁
My uploader works fine, but now I need to change the name of the file and then put it into my database.
So far I have...
$filename = rand(0,99999999);
if($_POST['upload']) {
if ($_FILES['image']['name'] == "") {
echo "Please select a file to upload!\n";
exit;
}
$uploads = "profileimages";
$types_array = array("image/gif","image/pjpeg","image/x-png");
if (!in_array($_FILES['image']['type'], $types_array)) {
echo "That file type is not allowed!\n";
exit;
}
$max_filesize = 307200;
if ($FILES['image']['size'] > $max_filesize) {
echo "That file type is too large!\n";
exit;
}
$imagesize = getimagesize($FILES['image']['tmp_name']);
$imagewidth = $size[0];
$imageheight = $size[1];
$maxwidth = 10000;
$maxheight = 10000;
if($imagewidth > $maxwidth || $imageheight > $maxheight) {
echo "That file type is too large!\n";
exit;
}
move_uploaded_file($FILES['image']['tmp_name'], "".$uploads."/".$FILES['image']['name']) or die ("Couldn't upload file!");
echo "File uploaded";
}
[/COLOR]
I need to somehow change the image name to $filename and then put it into my database (with the file extention)...
I know the code to put it into my database, but i need to know how i can put the name with the extention into a variable.
Thanks alot!!!!