Joker7 wrote:
Quote:
Can anyone see why Im lossing the image type when it's renamed !
>
Thanks
Chris
>
<?
session_start();
$n=$_FILES['user_file']['name'];
$type=$_FILES['user_file']['type'];
$size=$_FILES['user_file']['size'];
$time=time();
$n=$time;
$path="uploads\\". $n;
$uploaded = $_SESSION['firsttimeupload'];
if ($uploaded == "ok")
{
if ($size <900000 && ereg("image", $type ))
{
move_uploaded_file($_FILES['user_file']['tmp_name']['type'],
$path);
$root= "http://uploads/";
$path2=$root . $n;
echo "<center>";
echo "<h3>Your Image : </h3><a href=$path2>$path2</a><br /><br />";
echo "<br>";
echo "<img src=$path2 border='1'></img>";
echo "<center>";
$fp=fopen("links.text", "at");
fwrite($fp, $path2."\n");
fclose($fp);
session_destroy();
}
}
else
{
echo "File all ready uploaded";
}
>
if ($size>900000)
{
echo "ERROR <br /the image size is too big";
}
>
if (!ereg("image", $type) )
{
echo "ERROR <br /the file is not image<br />";
}
>
?>
>
>
What are you expecting in $_FILES['user_file']['tmp_name']['type']?
There is no such array element. You do have
$_FILES['user_file']['tmp_name'] and $_FILES['user_file']['type'].
Also, NEVER depend on the 'type' value - if it is sent, it may or may
not be accurate. ALWAYS check the mimetype of the file on the server.
Check out exif_imagetype().
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================