Hello all,
this is my first post. I am a complete newbie at this. I have this problem that I am sure is easy to fix. I need a user to be able to upload 20 images to my mysql database from the web. I have read that this is not a good idea because of server load etc. This is not an issue for me. I need to input about 30 text fields and 20 images in blob. I can input one image and one description with this script
//
<?php
if ($action == "upload") {
// ok, let's get the uploaded data and insert it into the db now
include "open_db.inc";
if (isset($binFile) && $binFile != "none") {
$data = addslashes(fread(fopen($binFile, "r"), filesize($binFile)));
$strDescription = addslashes(nl2br($txtDescription));
$sql = "INSERT INTO binary_data ";
$sql .= "(description, bin_data, filename, filesize, filetype) ";
$sql .= "VALUES ('$strDescription', '$data', ";
$sql .= "'$binFile_name', '$binFile_size', '$binFile_type')";
$result = mysql_query($sql, $db);
echo "Thank you. The new file was successfully added to our database.<br><br>";
echo "<a href='main.php'>Continue</a>";
}
mysql_close();
} else {
?>
<HTML><style type="text/css">
<!--
body {
background-color: #FFFFCC;
}
-->
</style><title>Sql image upload form works</title>
<BODY>
<FORM METHOD="post" ACTION="add.php" ENCTYPE="multipart/form-data">
<div align="center">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="2000000">
<INPUT TYPE="hidden" NAME="action" VALUE="upload">
Welcome to the image upload page. Just upload away </div>
<TABLE BORDER="1" align="center">
<TR>
<TD>Description: </TD>
<TD><textarea name="txtDescription" rows="5" cols="50"></textarea></TD>
</TR>
<TR>
<TD>File: </TD>
<TD><INPUT TYPE="file" NAME="binFile"></TD>
</TR>
<TR>
<TD COLSPAN="2"><INPUT TYPE="submit" VALUE="Upload"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<?php
}
?>
can I adjust this script to have the 20 image fields and 20 descriptions that I need. I just can't figure out what I need to change. If there is some other script that I should use then let me know. I am trying my best to learn this. I thank you for your time