When I do this it won't upload pdf files.
if($step == "3") {
if($c1 == "") { $c1 = "#000000"; }
if($substep == "2") {
$max_size = 200000;
$uploadpath = $_SERVER['DOCUMENT_ROOT'].'/clcc/forms/events/'.$progid.'/';
if(!file_exists($uploadpath)) { mkdir($_SERVER['DOCUMENT_ROOT'].'/clcc/forms/events/'.$progid, 0777); }
if(isset($HTTP_POST_FILES['userfile'])) {
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {
if ($HTTP_POST_FILES['userfile']['size']>$max_size) { $imageerror = "$imageerror<br><font color=red>The file size is too big.</font>"; }
if ($HTTP_POST_FILES['userfile']['type']=="application/pdf") {}
else { $imageerror = "$imageerror<br><font color=red>Wrong file type. The file must be PDF format.</font>"; }
if (file_exists($uploadpath . $HTTP_POST_FILES['userfile']['name'])) { $imageerror = "$imageerror<br><font color=red>The file already exists</font>"; }
if($imageerror == "") {
$res = copy($HTTP_POST_FILES['userfile']['tmp_name'], $uploadpath . $HTTP_POST_FILES['userfile']['name']);
$filename = $HTTP_POST_FILES['userfile']['name'];
if (!$res) { $imageerror = "$imageerror<br><font color=red>Upload of file failed!</font>"; }
else {
echo "<font size=7>GO</font>";
$update = mysql_query("UPDATE events SET rgform = '$filename' WHERE id = '$eventid'");
$substep = "finish";
}
}
}
else { $substep = "finish"; }
}
else { $substep = "finish"; }
}
if($substep != "finish") {
echo "<form enctype=\"multipart/form-data\" method=post action=admin.php>";
echo "<input type=hidden name=p value=events>";
echo "<input type=hidden name=subpage value=newevent>";
echo "<input type=hidden name=step value=3>";
echo "<input type=hidden name=substep value=2>";
echo "<input type=hidden name=eventid value=$eventid>";
echo "<table border=0 cellspacing=2 cellpadding=2 width=500>";
echo " <tr>";
echo " <td colspan=4>";
echo " $imageerror";
echo " </td>";
echo " </tr>";
echo " <tr>";
echo " <td width=380 bgcolor=#0A1A35 colspan=4>";
echo " <font color=#FFFFCC>";
echo " <b>New Event - <i>Registration Form</i></b>";
echo " </font>";
echo " </td>";
echo " </tr>";
echo " <tr>";
echo " <td valign=top width=100>";
echo " <font color=$c7>File</font>";
echo " </td>";
echo " <td valign=top width=300>";
echo " <INPUT TYPE=\"file\" NAME=\"userfile\" VALUE=\"\">";
echo " <br clear=all>";
echo " <font size=1>(Must be PDF format.)</font>";
echo " </td>";
echo " <td valign=top width=100 bgcolor=#FFFFCC>";
echo " The file containing a registration form for this Event. Leave blank for none.";
echo " </td>";
echo " </tr>";
echo " <tr>";
echo " <td colspan=2 align=right width=400>";
echo " (Page 3 of 3)";
echo " </td>";
echo " <td align=right height=27>";
echo " <input type=submit value='Finish'>";
echo " </td>";
echo " </tr>";
echo " <tr>";
echo " <td width=570 colspan=4 height=50>";
echo " </td>";
echo " </tr>";
echo "</table>";
}
if($substep == "finish") {
echo "<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=admin.php?p=events&subpage=adminevent&id=$eventid\">";
}
}