maybe because when you're learning you ask silly things!!
:p
this is what I have:
you upload a file using a form
then it checkes if it's a jpg
and then, if is, you're redirected to a new page
I can do this sending the variable with the url
so I was wondering if this was possible any other way...
<?php
ob_start();
?>
<?php echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?".">"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>experience</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<form enctype="multipart/form-data" action="<?php $PHP_SELF ?>" method="post">
<input type="hidden" name="MAX_FILE_UPLOAD" value="204800"><br />
upload a jpg<br />
<input type="file" name="userfile"><br />
<input type="submit" name="done" value="upload file">
<?php
if(isset($_POST['done'])){
if($_FILES['userfile']['tmp_name']=="none"){
echo"<br />";
echo "try again";
exit();
}else{
$target = "uploads";
$my_file = $_FILES['userfile']['name'];
$ext = strrchr($my_file,'.');
if($ext == ".jpg"){
copy($_FILES['userfile']['tmp_name'], "$target/$my_file");
header("Location: imagem.php?image=".$my_file);
echo "<br />";
echo "$my_file uploaded!";
} else{
echo "<br />";
echo "not a jpg, try again";
}
}
}
?>
</form>
</body>
</html>