QUESTION 1)
try this. it works when i have it set to .php:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ $1.png [L,QSA]
RewriteRule ^(.*)$ $1.jpg [L,QSA]
RewriteRule ^(.*)$ $1.jpg [L,QSA]
and so on...
QUESTION 2)
this is what i do:
$username = $_SESSION['username'];
$target = "./photo/";
$filename = $_FILES['uploaded']['name']); //gets the file name - file.jpg
$targetnew = $target.$username."/".$filename; //
$target = $targetnew;unset($targetnew);
$ok=1;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded";
i'm sure there are other more reliable and smiled-upon ways to do this, but this is how i get the name and extension seperately:
$filename = $_FILES['uploaded']['name'];
$filenamearray = explode(".", $filename);
$name = $filenamearray[0]; //the part before the first period
$ext = $filenamearray[1]; //after the period
so in theory,
$_FILES['uploaded']['name']
should be the same as
$name.".".$ext
.
before i upload the files, i make sure there is only one period in the filename.