Used this code to upload file...works perfectly on a previous site i made. it says upload ok, but then, i cant read it later... the file is there (checked on ftp) but can't read it, delete it... ftp says: 550 5rv53ox7.jpg: No such file or directory. File permissions are ok(755), so don't know what to do now...
here's the code:
<?
include ('auth.php');
include ('dbconnect.php');
$user=$session['user'];
function RandomString( $L=8) {
$password = "";
for ($index = 1; $index <= $L; $index++) {
$randomNumber = rand(1, 37);
if ($randomNumber < 11)
$password .= Chr($randomNumber + 48 - 1);
else if ($randomNumber < 37)
$password .= Chr($randomNumber + 86);
}
return $password;
}
$file=Randomstring();
$file="banner/".$file;
while (file_exists($file)) {
$rndir=Randomstring();
$file="banner/".$rndir; };
$path_parts = pathinfo($FILES['userfile']['name']);
$kit=".".$path_parts["extension"] . "\n";
$ul=$file.$kit;
print "<pre>";
if (move_uploaded_file($FILES['userfile']['tmp_name'], $ul)) {
print "File successfully uploaded";
};
$sql="INSERT INTO banner (user,bannercim,leiras,url,count) VALUES ('$user','$ul','$leiras','$bannercim','0');";
$result=mysql_query($sql) or die ("Cannot add banner:".mysql_error());
print "Added</body></html>";
?>