This is kinda weird. I think I got how to upload the picture but it says
"Warning: Unable to open '' for reading: Permission denied in c:\phpweb/olade/conferenceuploadconfirm.php on line 14"
HERE'S MY UPLOAD SCRIPT
<?PHP
print "
<form action=\"conferenceuploadconfirm.php\" enctype=\"multipart/form-data\" method=\"post\">
<table width=600 border=0>
<input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"100000\">
<input type=\"hidden\" name=\"confid\" value=$confid>
<tr>
<td bgcolor=#336699 colspan=2>
<font color=#ffffff><B>STEP 2: Add sponsors and upload pictures</b></font>
</td>
</tr>
<tr>
<td width=120>
<B>Sponsor Name:</b>
</td>
<td>
<input type=\"text\" name=\"sponsor\" size=50>
</td>
</tr>
<tr>
<td>
<B>File Location:</b>
</td>
<td>
<input type=\"file\" name=\"fupload\" size=50>
</td>
<tr>
<td colspan=2>
<input type=\"submit\" value=\"Submit\">
<input type=\"reset\" value=\"Reset\">
</td>
</tr>
</form>
";
?>
HERE'S MY CONFIRMATION SCRIPT
(Line 14 is indicated by *********)
<?PHP
function insertpicture($imagename,$confid)
{
//Copy picture into directory and rename image to sponsorname.jpg
if(copy($fupload, "sponsors/$imagename"))
{
//Save picture name into database + check to see if sucessful
$insertsponsor = mysql_query("INSERT INTO sponsors SET sponsor='$sponsor', imagename='$imagename', confid='$confid'");
if(!$insertsponsor)
{
print "<B>ERROR:</b> The following error occurred when updating the database: ".mysql_error();
}
//Show jpeg that was just uploaded.
print "<B>SUCCESSFUL</b> The picture for $sponsor has been uploaded.
<img src=\"sponsors/$imagename\">";
}
}
print "DEBUG: $confid is confid<BR>
$sponsor is sponsor<BR>
$fupload_type is fupload type<BR>
$confid is confid<BR>";
//Check for valid picture type (JPEG or GIF)
if($fupload_type=="image/pjpeg")
{
$imagename = "$sponsor".".jpg";
print "This is a jpg called: $imagename<BR>";
insertpicture($imagename,$confid);
unlink($fupload);
}
else if($fupload_type=="image/gif")
{
$imagename = "$sponsor".".gif";
print "This is a gif called: $imagename<BR>";
insertpicture($imagename,$confid);
unlink($fupload);
}
else //INVALID FILE FORMAT
{
print "<B>ERROR:</b> This image format cannot be uploaded and viewed over the web. Please ensure that only jpeg and gif images are uploaded.";
}
?>
I hope some one can help me out.
Thanks,
Mike