$back"; } $type = strtolower( strstr( $filename, '.' ) ); if ( !in_array( $type, $valid ) ) { $error .= "Unsupported FileType $back"; } if ($filesize>$maxfilesize) { $error .= "File was too big
$back"; } $randnum = generate_rand(10); $randnum .= $type; $file_exists = true; while ($file_exists) { if (file_exists("$uploaddir$randnum")) { $randnum = generate_rand(10); $randnum .= $type; }else{ $file_exists = false; } } if ($error == "") { if (move_uploaded_file($filetmpname, "$uploaddir$randnum")) { chmod("$uploaddir$randnum", 0644); echo "Success
"; echo "$site$updir/$randnum
"; echo "$back"; } else { echo "Error $back"; } }else{ echo $error; } }else{ echo "Error $back"; } }else{ ?>