Hi,
I'm having a problem with a file upload.
My code looks as follows :
<?
include("config.ini");
include("funcs.php3");
if(empty($Image1)) {
?>
<center>
<table cellpadding=2 cellspacing=0 border=1>
<tr><td bgcolor="<? echo $main_color ?>" width=100>Select the file you wish
to upload.
<br>It must be less than 300KB.</td>
<td><form action="<? echo $PHP_SELF ?>" enctype="multipart/form-data"
method=post>
<input type=hidden name="pid" value="<? echo $pid ?>">
<input type="file" name="<? $Image1 ?>" size="20"><br>
<? $userid=get_userid($store_user_cookie); ?>
<input type=submit value="Upload">
</form></td></tr></table>
<?
die();
}
function checkImgType($image_type,$image_name){
if((strcmp($image_type,"image/jpeg")==0)||(strcmp($image_type,"image/gif")==
0)||(strcmp($image_type,"image/pjpeg")==0)||(strcmp($image_type,"image/jpg")
==0))
{
switch($image_type){
case "image/jpg":
$imageExt=".jpg";
break;
case "image/jpeg":
$imageExt=".jpg";
break;
case "image/pjpeg":
$imageExt=".jpg";
break;
case "image/gif":
$imageExt=".gif";
break;
}
return $imageExt;
}
else {
print "<b><font color=red>$image_name is not a valid file to upload.<br>
Please upload JPEG (.jpg) or GIF (.gif) type images
only.</font></b><br> <br>";
return 0;
}
}
$ABS_IMAGES_DIR=$path_to_fullsize;
if($Image1!="none") {
$Image1Ext=checkImgType($Image1_type,$Image1_name);
}
if($Image1Ext=='0') {
echo '<br><div align="center"><b><blink>Please press back on your browser to
correct
the image(s).</blink></b></div>';
exit();
}
if($Image1!="none") {
$i = substr($Image1_name,0,strlen($Image1_name)-4);
$Image1Final=$ABS_IMAGES_DIR.$i.$Image1Ext;
copy($Image1, $Image1Final);
}
include("conn.php3");
// generate the proper web directory path
$image_loc = "/auction/fullsize".$Image1_name;
$result = mysql_query("update products set picture = '$image_loc'
where(pid = '$pid')") or die("Image update failed.");
print "The your image $Image1_name, was copied to $Image1_name. We have
adjusted your auction for
<a href=\"buy.php3?pid=$pid\">item #$pid.</a>";
?>
Whenever I execute this code, I'm getting an error the looks like this :
Warning: SAFE MODE Restriction in effect. The script whose uid is 177909 is
not allowed to access /tmp/php9ex7F1 owned by uid 0 in
..../auction/upload.php3 on line 68
What am I doing wrong here?
Is there a way to get around the temporary folder?
Tnx
Brave Cobra