So I edited around, and am now at this stage. I have this inclusion file to browse for images, 5 and numbered accordingly. The handling page xhandleaanbod.php, has the submit button
<?php
?>
<table>
<tr>
<td><form method=POST action=xhandleaanbod.php enctype=multipart/form-data>
Omschrijving:
</td>
<td><input type=text name=form_description1 size=25>
</td>
</tr>
<tr>
<td><input type=hidden name=MAX_FILE_SIZE value=1000000>
Bestand:
</td>
<td><input type=file name=form_data1 size=25>
</td>
</tr>
</table>
<?php
?>
The handling part of the script is as follows
<?php
// Set variables:
$Host = "localhost";
$Gebruiker = "";
$Wachtwoord = "";
$DBNaam = "";
$Tabelnaam = "aanbod";
$Conn = mysql_connect ($Host, $Gebruiker, $Wachtwoord) or die("No connection to database");
// select database
mysql_select_db ("$DBNaam");
// Cut values to size.
$adres = trim (htmlspecialchars($_POST["adres"]));
$verkocht = trim (htmlspecialchars($_POST["verkocht"]));
$form_description1 = trim (htmlspecialchars($_POST["form_description1"]));
$form_description2 = trim (htmlspecialchars($_POST["form_description2"]));
$form_description3 = trim (htmlspecialchars($_POST["form_description3"]));
$form_description4 = trim (htmlspecialchars($_POST["form_description4"]));
$form_description5 = trim (htmlspecialchars($_POST["form_description5"]));
// store the file information to variables for easier access 1
$tmp_name1 = $_FILES['form_data1']['tmp_name'];
$type1 = $_FILES['form_data1']['type'];
$name1 = $_FILES['form_data1']['name'];
$size1 = $_FILES['form_data1']['size'];
// store the file information to variables for easier access 2
$tmp_name2 = $_FILES['form_data2']['tmp_name'];
$type2 = $_FILES['form_data2']['type'];
$name2 = $_FILES['form_data2']['name'];
$size2 = $_FILES['form_data2']['size'];
// store the file information to variables for easier access 3
$tmp_name3 = $_FILES['form_data3']['tmp_name'];
$type3 = $_FILES['form_data3']['type'];
$name3 = $_FILES['form_data3']['name'];
$size3 = $_FILES['form_data3']['size'];
// store the file information to variables for easier access 4
$tmp_name4 = $_FILES['form_data4']['tmp_name'];
$type4 = $_FILES['form_data4']['type'];
$name4 = $_FILES['form_data4']['name'];
$size4 = $_FILES['form_data4']['size'];
// store the file information to variables for easier access 5
$tmp_name5 = $_FILES['form_data5']['tmp_name'];
$type5 = $_FILES['form_data5']['type'];
$name5 = $_FILES['form_data5']['name'];
$size5 = $_FILES['form_data5']['size'];
// if the upload succeeded, the file will exist
if (file_exists($tmp_name1) && file_exists($tmp_name2) &&
file_exists($tmp_name3) && file_exists($tmp_name4) &&
file_exists($tmp_name5)) {
// check to make sure that it is an uploaded file and not a system file
if (is_uploaded_file($tmp_name1) && is_uploaded_file($tmp_name2) &&
is_uploaded_file($tmp_name3) && is_uploaded_file($tmp_name4) &&
is_uploaded_file($tmp_name5)) {
// open the file for a binary read
$file1 = fopen($tmp_name1,'rb');
$file2 = fopen($tmp_name2,'rb');
$file3 = fopen($tmp_name3,'rb');
$file4 = fopen($tmp_name4,'rb');
$file5 = fopen($tmp_name5,'rb');
// read the file content into a variable
$data1 = fread($file1,filesize($tmp_name1));
$data2 = fread($file2,filesize($tmp_name2));
$data3 = fread($file3,filesize($tmp_name3));
$data4 = fread($file4,filesize($tmp_name4));
$data5 = fread($file5,filesize($tmp_name5));
// close the file
fclose($file1) && fclose ($file2) && fclose($file3) && fclose ($file4) && fclose ($file5);
// now we encode it and split it into acceptable length lines
$data1 = chunk_split(base64_encode($data1));
$data2 = chunk_split(base64_encode($data2));
$data3 = chunk_split(base64_encode($data3));
$data4 = chunk_split(base64_encode($data4));
$data5 = chunk_split(base64_encode($data5));
}
else {
print("<br><b>Is thisn thing working? At all?</b><br>\n");
}
}
else {
print("<br><b>Nope, not yet...</b><br>\n");
}
$query = "INSERT into $Tabelnaam (adres,verkocht,
description1,bin_data1,filename1,filesize1,filetype1,
description2,bin_data2,filename2,filesize2,filetype2,
description3,bin_data3,filename3,filesize3,filetype3,
description4,bin_data4,filename4,filesize4,filetype4,
description5,bin_data5,filename5,filesize5,filetype5)
values
('$adres', '$verkocht',
'$form_description1', '$data1', '$name1', '$size1', '$type1',
'$form_description2', '$data2', '$name2', '$size2', '$type2',
'$form_description3', '$data3', '$name3', '$size3', '$type3',
'$form_description4', '$data4', '$name4', '$size4', '$type4',
'$form_description5', '$data5', '$name5', '$size5', '$type5')";
$Task = mysql_query($query) or die(mysql_error());
print ("The task is:<br />$Task<P>\n");
if(mysql_affected_rows($Verbinding) == 1)
{
print ("Task executed successfully!<br>\n");
}
else
{
print ("Task not executed at all!<br>\n");
}
mysql_close ($Conn);
?>
There is some debugging going on here, and then I get this error message:
Nope, not yet...
The task is:
1
Task executed successfully!
What am I doing wrong?