paprik Posted November 5, 2006 Share Posted November 5, 2006 i have a php form to upload one picture, how make a form to upload three pictures...[code]<?phpif ($action == "upload") {// ok, let's get the uploaded data and insert it into the db nowinclude "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}?>[/code] Link to comment https://forums.phpfreaks.com/topic/26215-upload-multiple-pictures-in-mysql/ Share on other sites More sharing options...
glenelkins Posted November 5, 2006 Share Posted November 5, 2006 you can create the file fields with a loop, and set each name as "binFile[]" . Then the action code foreach ($_FILES as $file) Link to comment https://forums.phpfreaks.com/topic/26215-upload-multiple-pictures-in-mysql/#findComment-119973 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.