why does it say wrongfiletype? [omit/delete this question]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
cybergirl
Forum Commoner
Posts: 36
Joined: Wed Dec 07, 2005 1:11 pm

why does it say wrongfiletype? [omit/delete this question]

Post by cybergirl »

I don't understand why I get an error message for the file type, here's the code:

Code: Select all

<?php
$cnxdb = mysql_connect("localhost", "dtours3_deb", "cybergirl") or die("Could not connect: " . mysql_error());
mysql_select_db("dtours3_rich");

if(isset( $Submit ))
{
//If the Submitbutton was pressed do:
if ( ($_FILES['tourimage01']['tourimage02']['tourimage03']['tourimage04']['tourimage05']['tourimage01thumb']['tourimage02thumb']['tourimage03thumb']['tourimage04thumb']['tourimage05thumb']['type'] == "image/gif") || ($_FILES['tourimage01']['tourimage02']['tourimage03']['tourimage04']['tourimage05']['tourimage01thumb']['tourimage02thumb']['tourimage03thumb']['tourimage04thumb']['tourimage05thumb']['type'] == "image/jpg") ){
copy ($_FILES['tourimage01']['tourimage02']['tourimage03']['tourimage04']['tourimage05']['tourimage01thumb']['tourimage02thumb']['tourimage03thumb']['tourimage04thumb']['tourimage05thumb']['tmp_name'], "tours/tourimages/".$_FILES['tourimage01']['tourimage02']['tourimage03']['tourimage04']['tourimage05']['tourimage01thumb']['tourimage02thumb']['tourimage03thumb']['tourimage04thumb']['tourimage05thumb']['name']) or die ("Could not copy.....");

$strDescription = addslashes(nl2br($txtDescription));
$straddress = addslashes(nl2br($txtaddress));
$imagefile = $_FILES['tourimage01']['tourimage02']['tourimage03']['tourimage04']['tourimage05']['tourimage01thumb']['tourimage02thumb']['tourimage03thumb']['tourimage04thumb']['tourimage05thumb']['name'];

$query = "INSERT INTO tours (tourid, title, company, address, desc, feature_num, tourimage01, tourimage02, tourimage03, tourimage04, tourimage05, tourimage01thumb, tourimage02thumb, tourimage03thumb, tourimage04thumb, tourimage05thumb, logo ) VALUES ('', '$title', '$company', '$straddress', '$strDescription', '$feature_num', '$tourimage01','$tourimage02','$tourimage03', '$tourimage04', '$tourimage05', '$tourimage01thumb', '$tourimage02thumb', '$tourimage03thumb', '$tourimage04thumb', '$tourimage05thumb', logo)";
mysql_query($query, $cnxdb);

echo "";
echo "Name: ".$name."";
echo "Size: ".$_FILES['tourimage01']['size']."";
echo "Type: ".$_FILES['tourimage01']['type']."";
echo "Size: ".$_FILES['tourimage02']['size']."";
echo "Type: ".$_FILES['tourimage02']['type']."";
echo "Size: ".$_FILES['tourimage03']['size']."";
echo "Type: ".$_FILES['tourimage03']['type']."";
echo "Size: ".$_FILES['tourimage04']['size']."";
echo "Type: ".$_FILES['tourimage04']['type']."";
echo "Size: ".$_FILES['tourimage05']['size']."";
echo "Type: ".$_FILES['tourimage05']['type']."";
echo "Size: ".$_FILES['tourimage01thumb']['size']."";
echo "Type: ".$_FILES['tourimage01thumb']['type']."";
echo "Size: ".$_FILES['tourimage02thumb']['size']."";
echo "Type: ".$_FILES['tourimage02thumb']['type']."";
echo "Size: ".$_FILES['tourimage03thumb']['size']."";
echo "Type: ".$_FILES['tourimage03thumb']['type']."";
echo "Size: ".$_FILES['tourimage04thumb']['size']."";
echo "Type: ".$_FILES['tourimage04thumb']['type']."";
echo "Size: ".$_FILES['tourimage05thumb']['size']."";
echo "Type: ".$_FILES['tourimage05thumb']['type']."";
echo "Size: ".$_FILES['logo']['size']."";
echo "Type: ".$_FILES['logo']['type']."";
echo "Copy Done....";
}
else {
echo "";
echo "Could Not Copy, Wrong Filetype (".$_FILES['tourimage01']['name'].")";
echo "Could Not Copy, Wrong Filetype (".$_FILES['tourimage02']['name'].")";
echo "Could Not Copy, Wrong Filetype (".$_FILES['tourimage03']['name'].")";
echo "Could Not Copy, Wrong Filetype (".$_FILES['tourimage04']['name'].")";
echo "Could Not Copy, Wrong Filetype (".$_FILES['tourimage05']['name'].")";
echo "Could Not Copy, Wrong Filetype (".$_FILES['tourimage01thumb']['name'].")";
echo "Could Not Copy, Wrong Filetype (".$_FILES['tourimage02thumb']['name'].")";
echo "Could Not Copy, Wrong Filetype (".$_FILES['tourimage03thumb']['name'].")";
echo "Could Not Copy, Wrong Filetype (".$_FILES['tourimage04thumb']['name'].")";
echo "Could Not Copy, Wrong Filetype (".$_FILES['tourimage05thumb']['name'].")";

}
}
?>
ERROR MESSAGE:
Could Not Copy, Wrong Filetype (lobby.jpg)Could Not Copy, Wrong Filetype (office.jpg)Could Not Copy, Wrong Filetype (conference.jpg)Could Not Copy, Wrong Filetype (reception.jpg)Could Not Copy, Wrong Filetype ()Could Not Copy, Wrong Filetype (lobby-150.jpg)Could Not Copy, Wrong Filetype (office-150.jpg)Could Not Copy, Wrong Filetype (conference-150.jpg)Could Not Copy, Wrong Filetype (reception-150.jpg)Could Not Copy, Wrong Filetype ()
Last edited by cybergirl on Tue Aug 21, 2007 3:33 pm, edited 1 time in total.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

What's
$_FILES['tourimage01']['tourimage02']['tourimage03']['tourimage04']['tourimage05']['tourimage01thumb']['tourimage02thumb']['tourimage03thumb']['tourimage04thumb']['tourimage05thumb']['type']
supposed to do?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Your $_FILES....['type'] checks won't work unless you have some very oddly named form elements.
cybergirl
Forum Commoner
Posts: 36
Joined: Wed Dec 07, 2005 1:11 pm

Post by cybergirl »

ok scrap that.
thanks.
Post Reply