Hi Guys,
I have a form for uploading files to my website and conditions to state what types of files are uploaded where.
However It throws up $error even though you are uploading the correct extentions:
[code]
$puzzle= “upload/$one”.$_FILES[‘ufile’][‘name’][0];
$pdf= “upload/$two”.$_FILES[‘ufile’][‘name’][1];
$png= “upload/$three”.$_FILES[‘ufile’][‘name’][2];
//copy file to where you want to store file
move_uploaded_file ($_FILES[‘ufile’][‘tmp_name’][0], $puzzle);
move_uploaded_file($_FILES[‘ufile’][‘tmp_name’][1], $pdf);
move_uploaded_file($_FILES[‘ufile’][‘tmp_name’][2], $png);
//check file extensions
$ext_puz = $puzzle[count($puzzle) – 1];
$ext_pdf = $pdf[count($pdf) – 1];
$ext_png = $png[count($png) – 1];
// ** Check for Required Fields with IF statements **
if (empty($title)){
$error = “** You forgot to enter a title **”;
$flag=1;
} if (empty($type)){
$error = “** Error: You forgot to enter the type of puzzle! **”;
$flag=1;
} if (empty($about)){
$error = “** Error: You forgot to enter any about info! **”;
$flag=1;
} if (empty($_FILES[‘ufile’][‘tmp_name’][0]) || (strtolower($ext_puz) != “jpz”)) {
$error = “** Error: You forgot to upload a puzzle file (jpz)! **”;
$flag=1;
} if (empty($_FILES[‘ufile’][‘tmp_name’][1]) || (strtolower($ext_pdf) != “pdf”)) {
$error = “** Error: You forgot to upload a pdf! **”;
$flag=1;
} if (empty($_FILES[‘ufile’][‘tmp_name’][2]) || (strtolower($ext_png) != “png”)) {
$error = “** Error: You forgot to upload a png solution file! **”;
$flag=1;
}
I’m a bit stumped! Any ideas?
[/quote]
Thanks