I am using this script to upload pictures, it will put the image name into the database, but does not upload the picture to the folder that I specified.
<form action="addproperty.php" method="post" name="form1" enctype="multipart/form-data">
<table align="center">
<tr>
<td width="117" class="smalltext"><div align="right"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Name:</font></div></td>
<td width="308"><input type="text" size=40 name="property_name"></td>
</tr>
<tr>
<td class="smalltext"><div align="right"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Address:</font></div></td>
<td><input type="text" size=40 name="property_address"></td>
</tr>
<tr>
<td class="smalltext" valign=top><div align="right"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">City,
State Zip:</font></div></td>
<td><input name="property_citystatezip" type="text" size="40"></td>
</tr>
<tr>
<td valign=top class="smalltext"> <div align="right"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Brief
Description::</font></div></td>
<td><textarea name="property_briefdescription" cols="35" rows="2"></textarea></td>
</tr>
<tr>
<td height="76" valign=top class="smalltext"> <div align="right"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Community
Info:</font></div></td>
<td><textarea name="property_communityinfo" cols="35" rows="10"></textarea></td>
</tr>
<tr>
<td class="smalltext" valign="top"><div align="right"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Upload
picture:</font></div></td>
<td><input type="file" name="property_imagelocation">
<input type="hidden" name="MAX_FILE_SIZE" value="51200"></td>
</tr>
<tr>
<td align="center" colspan="2"><input class="button" type="submit" value="Submit"></td>
</tr>
</table>
</form>
This is the addproperty.php file
<?php
$file_dir = "/www/htdocs/images/propertymanagement/buildings";
$file_url = "http://www.mysite.com/images/propertymanagement/buildings";
// print "path: $property_imagelocation<br>\n";
// print "name: $property_imagelocation_name<br>\n";
// print "size: $property_imagelocation_size bytes<br>\n";
// print "type: $property_imagelocation_type<p>\n\n";
if ( ( $property_imagelocation_type == "image/pjpeg") && $MAX_FILE_SIZE <= "51200" )
{
$db = "";
$link = mysql_connect("");
if ( !$link ) die( "Couldn't connect to MySQL".mysql_error() );
mysql_select_db( $db, $link ) or die( "Couldn't open $db: ".mysql_error() );
$sql = "INSERT INTO property VALUES ( '', '$property_name', '$property_address', '$property_citystatezip', '$property_briefdescription', '$property_communityinfo', '$property_imagelocation_name')";
mysql_query( $sql, $link );
mysql_close( $link );
copy ( $property_imagelocation, "$file_dir/$property_imagelocation_name" ) or die ("Couldn't copy");
}
else
{
if ( $MAX_FILE_SIZE > "32000" ){
print "File size beyond maximum size of 51,200 bytes - ($property_imagelocation_size bytes)";
exit;
}
elseif ( $property_imagelocation_type != "image/pjpeg" ){
print "Invalid file type $property_imagelocation_type. Please submit only pjepg images (with extensions .jpg / .jpeg)";
exit;
}
else
{
print "Failed - reason unknown.";
exit;
}
}
?>
Thanks in advance.