Forum Moderators: coopster
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type=file name="FileToUpload" value="">
<input type="hidden" name="MaxFileSize" value="64000">
<input type="submit" name="Submit" value="Submit">
<form>
and my upload.php page look like this:
if ($FileToUpload_type == 'image/gif') {
$type = '.gif';
}
if ($FileToUpload_type == 'image/pjpeg') {
$type = '.jpg';
}
if ($FileToUpload_type == 'image/x-png') {
$type = '.jpg';
}
$newfile = substr($FileToUpload, -9);
if($FileToUpload_name = '') {
print("No file was selected!");
}
elseif($FileToUpload_size > $MaxFileSize) {
print("The file to upload is too big");
}
else {
$query = "INSERT INTO photos (`handle`, `location`, `photodesc`)
VALUES ('".$_SESSION['handle']."','$newfile$type', 'ad')";
//$result = mysql_query($query,$db_object) or die("ERROR");
echo $query;
//move_uploaded_file($FileToUpload, "/full/path/on/your/server/images/$newfile$type");
}
When I try this I just get this error:
Notice: Undefined variable: FileToUpload_type in line 14...
How come it can't get the variable?
how about this for an example?
[ca2.php.net...]
if ($_FILES['FileToUpload']['type'] == "put_type_here") may work