I am having trouble with this script.
Whas wrong with this. Heres the erros i get.
Warning: Unable to create '/usr/www/users/shafey7s/clients/projects/baintown/dynamic_content/temp//usr/tmp/phphY3Ph8': No such file or directory in /usr/www/users/shafey7s/clients/projects/baintown/admin/newsadd.php on line 48
Warning: Unable to move '/usr/tmp/phphY3Ph8' to '/usr/www/users/shafey7s/clients/projects/baintown/dynamic_content/temp//usr/tmp/phphY3Ph8' in /usr/www/users/shafey7s/clients/projects/baintown/admin/newsadd.php on line 48
<?
if($step ==2)
{?>
<b>Home Page Image Upload: Approve Image</b>
<FORM ACTION="image_upload.php" METHOD="POST" ENCTYPE="multipart/form-data">
<INPUT TYPE="hidden" NAME="step" VALUE="3">
<?PHP
mt_srand((double)microtime() * 1000000);
$randomKey = (mt_rand(1,5000));
$source=$HTTP_POST_FILES['image']['tmp_name'];
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 = "/usr/www/users/shafey7s/clients/projects/baintown/dynamic_content/temp/$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] > 800 )
{
echo'<BR><FONT COLOR="RED">ERROR:</FONT> Image is '.$imagesize[0].' pixels wide. Images must not be more than 800 pixels wide and 600 pixels high.<BR>';
$denied = 1;
}
if ( $imagesize[1] > 600 )
{
echo'<BR><FONT COLOR="RED">ERROR:</FONT> Image is '.$imagesize[0].' pixels wide. Images must not be more than 800 pixels wide and 600 pixels high.<BR>';
$denied = 1;
}
if($dest!='' && $denied != 1){
if(move_uploaded_file($source,$dest)){
echo'File uploaded. If this image is correct, click "approve". Otherwise, <a href="image_upload.php?step=0">click here</a> to start over.<br><p> Uploaded Home Page Image:<br>
<p><IMG SRC="../dynamic_content/temp/$source?<?PHP echo "$randomKey"; ?>" WIDTH="375" HEIGHT="281" BORDER="0"><br>';
} 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>';
}
?>
<br>
<p>
<INPUT TYPE="SUBMIT" NAME="Submit" VALUE="Approve">
</FORM>
<?PHP
}
else if ($step == 3)
{
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);
$date = date('Y-m-d H:i:0',mktime($hour,$minute,0,$month,$day,$year));
$result =mysql_query("INSERT news SET template='$template',date_status='$dateoff', name='$imagename', title='$title', teaser='$teaser', text='$text', date='$date'") or die ("Couldnt Execute query".mysql_error());?>
<b>Article Added</b><br><br>
<b>Template id:</b> <? echo $template;?><br>
<b>Image Name:</b><? echo $imagename;?><br>
<b>Date:</b><? echo $date;?><br>
<b>Title:</b><? echo $title;?><br>
<b>Teaser</b><<? echo $teaser;?><br>
<b>News:</b><? echo $text ;?>
$original = "../dynamic_content/temp/$source";
$new = "../dynamic_content/$source";
copy ($original, $new);
mt_srand((double)microtime() * 1000000);
$randomKey = (mt_rand(1,5000));
?>
Home Page Image Upload: Image Upload Confirmed
Confirmed Uploaded News Image:<br>
<p><IMG SRC="../dynamic_content/temp/$source?<?PHP echo "$randomKey"; ?>" WIDTH="375" HEIGHT="281" BORDER="0">
<?PHP
}
?>