Code: Select all
<?php
function getNextSerial($prefix, $path)
{
$max = -1;
$dir = opendir($path);
while($fname = readdir($dir))
{
if(strpos($fname, $prefix) === (int)0)
$max = max($max, (int)substr($fname, strlen($prefix)));
}
return ++$max;
}
$postfix = strrchr($_FILESї'filename']ї'name'], '.');
$fname = '../../darkside/Upload/fubar' . getNextSerial('fubar', '../../darkside/Upload/fubar' ).$postfix;
if(!(copy($_FILESї'userfile']ї'tmp_name'], "$fname" . ".jpg")));
$post_data = "posts.php";
$data = fopen($post_data, "a");
fwrite($data, "$fname");
fclose($data);
?>But i want it so the the user can choose from 5 diffrent folders to upload the image to (from a drop down menu on the forum)
Code: Select all
$postfix = strrchr($_FILESї'filename']ї'name'], '.');
$fname = ("$god").('fubar') . getNextSerial('fubar',"$god".$postfix);the right hand code works
Code: Select all
$postfix = strrchr($_FILESї'filename']ї'name'], '.');
$fname = ("$god").('fubar')Code: Select all
getNextSerial('fubar',"$god".$postfix);Ok then there is alot of code up and round there but its the only way this is going to make any sence. Any help wouldnt go a miss.