Hello All:
Using the script below gives me resource ID #'s for photo1 photo2 etc.. Why is this happening? am I missing a parameter here or are my sets wrong? The script works great except for where I want to take userfile[0] and change its name to be the form names I have listed. Any help is appreciated!
<?
for($i=0;$i<sizeof($userfile);$i++)
{
if(!$userfile_size[$i])
continue;
$UPLOAD = fopen( $userfile[$i], "r" );
$contents = fread( $UPLOAD,$userfile_size[$i]);
fclose( $UPLOAD );
$SAVEFILE = fopen( "upload//".$userfile_name[$i], "wb" );
fwrite( $SAVEFILE, $contents,$userfile_size[$i] );
fclose( $SAVEFILE );
}
$userfile[0]=$mls.$agent_id_1;
$photo1 = fopen("$userfile[0]","wb");
$userfile[1]=$mls.$agent_id_2;
$photo2 = fopen("$userfile[1]","wb");
@ $db = mysql_pconnect("localhost", "root", "");
if (!$db)
{
echo "Error: Could not connect to database. Please try again later.";
exit;
}
mysql_select_db("waterfront");
$query = "insert into waterfront values ('".$agent_id."', '".$layout."', '".$page."', '".$position."', '".$text."', '".$address."', '".$city."', '".$state."', '".$zip."', '".$bedrooms."', '".$bathrooms."', '".$price."', '".$mls."', '".$instructions."', '".$photo1."', '".$photo2."', '".$photo3."', '".$photo4."', '".$photo5."', '".$photo6."', '".$photo7."', '".$photo8."', '".$photo9."', '".$photo10."')";
$result = mysql_query($query);
if ($result)
echo "Server HaD Receive the Upload Files!";
?>