I am having problems uploading and im always getting my error message.
ERROR: File not supplied, or file too big.
Please try again with a smaller file.
(Under 70k maximum, although files of 35k or less are preferred.)
Here is the code to upload
<? include ("../header.php");
require ("../config.php");
$connection = @mysql_connect($server, $user, $password) or die("Couldn't Connect.".mysql_error());
$db = @mysql_select_db($dbname, $connection) or die("Couldnt select database.".mysql_error());
$date = date('Y-m-d H:i:0',mktime($hour,$minute,0,$month,$day,$year));
switch ($mode){
case check:
?>
<table border=3 width=750 cellpadding=7>
<tr>
<td bgcolor="#0099FF">Add news: Approve</td>
</tr>
<tr><td><FORM ACTION="add_news_done.php?mode=approve" METHOD="POST" ENCTYPE="multipart/form-data">
<table border=0 cellspacing=0 cellpadding=0><tr>
<td valign="top">
<?PHP
mt_srand((double)microtime() * 1000000);
$randomKey = (mt_rand(1,5000));
$uploadpath = "../../news_images/temp/";
$source=$HTTP_POST_FILES['image']['tmp_name'];
$dest='';
if(($source!='none') && ($source!='')) {
$imagesize = getimagesize($source);
switch($imagesize[2]) {
case 0:
echo '<BR><FONT COLOR="RED">ERROR:</FONT> Image is not a JPG.<BR>';
break;
case 1:
echo '<BR><FONT COLOR="RED">ERROR:</FONT> Image is a GIF. It must be a JPG.<BR>';
break;
case 2:
$dest = $uploadpath.'$source';
break;
case 3:
echo '<BR><FONT COLOR="RED">ERROR:</FONT> Image is a PNG. It must be a JPG.<BR>';
break;
}
if ( $imagesize[0] != 375 )
{
echo'<BR><FONT COLOR="RED">ERROR:</FONT> Image is '.$imagesize[0].' pixels wide. Images must be 375 pixels wide by 281 pixels high.<BR>';
$denied = 1;
}
if ( $imagesize[1] != 281 )
{
echo'<BR><FONT COLOR="RED">ERROR:</FONT> Image is '.$imagesize[1].' pixels high. Images must be 375 pixels wide by 281 pixels high.<BR>';
$denied = 1;
}
if($dest!='' && $denied != 1){
if(move_uploaded_file($source,$dest)){
echo'File uploaded. If this image is correct, enter a caption below and then click "approve". Otherwise, <a href="../index.php">click here</a> to start over.<BR><p>
<table border="1" width="770">
<tr>
<td height="6" valign="top" width="260" class="text"> Date: </td>
<td width="260"><? echo $date;?></td>
</tr>
<tr>
<td valign="top" width="260" class="text"> Title: </td>
<td width="260"><? echo $title;?></td>
</tr>
<tr>
<td valign="top" width="260" class="text">Teaser: </td>
<td width="260"><? echo $teaser;?></td>
</tr>
<tr>
<td width="260" class="text">News</td>
<td rowspan="2" width="260"><? echo $text ;?></td>
</tr>
</table>
<br>
<p>
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Approve"></td><td> </td>
</tr></table> </td>
</tr></table><br></FORM> ';
} else {
echo'<BR><FONT COLOR="RED">ERROR:</FONT> File could not be stored due to file system error.<BR>';
}
}
}else{
echo'<BR><FONT COLOR="RED">ERROR:</FONT> File not supplied, or file too big.<br>Please try again with a smaller file.<br>(Under 70k maximum, although files of 35k or less are preferred.)<BR>';
}
break;
case approve:
?>
<table width="770" cellspacing="0" cellpadding="0" height="22">
<tr>
<td class="genheader" bgcolor="#0099FF"><b>Added News<b></td>
</tr>
<tr>
<td>
<?
mt_srand((double)microtime() * 1000000);
$randomKey = (mt_rand(1,5000));
//fliter naughty characters
if ($ampm=="PM" and $hour<>12)
{
$hour = $hour + 12;
}
if ($ampm=="AM" and $hour==12)
{
$hour = 0;
}
$text = addslashes($text);
$teaser = addslashes($teaser);
$title = addslashes($title);
$original = "../news_images/tmp/$source";
$new = "../news_images/$source";
copy ($original, $new);
$sql="INSERT news SET title='$title', teaser='$teaser', text='$text', date='$date', name='$imagename'" or die(mysql_error());
$result =mysql_query($sql) or die ("Couldnt Execute query".mysql_error());?>
<table border=1 width=770>
<tr>
<td height='6' valign='top' width='260' class='text'> Date: </td>
<td width='260'><? echo $date;?></td>
</tr>
<tr>
<td valign='top' width='260' class='text'> Title: </td>
<td width='260'><? echo $title;?></td>
</tr>
<tr>
<td valign='top' width='260' class='text'>Teaser: </td>
<td width='260'><? echo $teaser;?></td>
</tr>
<tr>
<td width='260' class='text'>News</td>
<td rowspan='2' width='260'><? echo $text ;?></td>
</tr>
</table>
</td>
<tr><td> <form method='post' action='review_news.php?<?$randomKey;?>'>
<input type='submit' value='Back' class='text'>
</form> </td>
</tr>
</table>
<?
};
include ("../footer.php");?>