upload multiple images with captions with single file field along with one text field for the captions
Have a single image upload with a caption text field and and a select field. Works fine. I want to be able to upload multiple images and the caption for each with just the single fields.Know hand coding is required as i have seen on another thread but can't get it to work.
Here is my current code
<?php require_once('Connections/connstake.php'); ?>
<?php require_once('webassist/mysqli/queryobj.php'); ?>
<?php require_once( "webassist/security_assist/helper_php.php" ); ?>
<?php
if (!WA_Auth_RulePasses("Logged in to admin")){
WA_Auth_RestrictAccess("admin_login.php");
}
?>
<?php require_once("webassist/file_manipulation/helperphp.php"); ?>
<?php
// WA_UploadResult1 Params Start
$WA_UploadResult1_Params = array();
// WA_UploadResult1_1 Start
$WA_UploadResult1_Params["WA_UploadResult1_1"] = array(
'UploadFolder' => "photos/",
'FileName' => "[FileName]",
'DefaultFileName' => "",
'ResizeType' => "0",
'ResizeWidth' => "120",
'ResizeHeight' => "120",
'ResizeFillColor' => "#FFFFFF" );
// WA_UploadResult1_1 End
// WA_UploadResult1 Params End
?>
<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if(isset($_POST["Insert"]) || isset($_POST["Insert_x"])){
WA_DFP_UploadFiles("WA_UploadResult1", "photos_image", "0", "", "true", $WA_UploadResult1_Params);
}
?>
<?php
if (isset($_POST["Insert"]) || isset($_POST["Insert_x"])) {
$InsertQuery = new WA_MySQLi_Query($connstake);
$InsertQuery->Action = "insert";
$InsertQuery->Table = "photos";
$InsertQuery->bindColumn("photos_image", "s", "".$WA_DFP_UploadStatus["WA_UploadResult1"]["WA_UploadResult1_1"]["serverFileName"] ."", "WA_BLANK");
$InsertQuery->bindColumn("photos_caption", "s", "".((isset($_POST["photos_caption"]))?$_POST["photos_caption"]:"") ."", "WA_BLANK");
$InsertQuery->bindColumn("photos_era", "s", "".((isset($_POST["photos_era"]))?$_POST["photos_era"]:"") ."", "WA_BLANK");
$InsertQuery->bindColumn("photos_ok", "s", "".((isset($_POST["photos_ok"]))?$_POST["photos_ok"]:"") ."", "WA_BLANK");
$InsertQuery->saveInSession("WADA_Insert_photos");
$InsertQuery->execute();
$InsertGoTo = "photos_results.php?photos_ID=[Insert_ID]";
if (function_exists("rel2abs")) $InsertGoTo = $InsertGoTo?rel2abs($InsertGoTo,dirname(__FILE__)):"";
$InsertQuery->redirect($InsertGoTo);
}
?>
Here is my form
<div id="Insert_Basic_Default_ProgressWrapper">
<form action="" method="post" enctype="multipart/form-data" name="Insert_Basic_Default" class="Basic_Default" id="Insert_Basic_Default">
<fieldset class="Basic_Default" id="Insert">
<legend class="groupHeader">Insert</legend>
<div class="lineGroup"> <label for="photos_image" class="sublabel" > photos_image:</label>
<input id="photos_image" name="photos_image" type="file" multiple value="" class="formTextfield_Medium" tabindex="1" title="">
</div>
<div class="lineGroup"> <label for="photos_caption" class="sublabel" > photos_caption:</label>
<input id="photos_caption" name="photos_caption" type="text" value="" class="formTextfield_Medium" tabindex="2" title="">
</div>
<div class="lineGroup"> <label for="photos_era" class="sublabel" > photos_era:</label>
<select name="photos_era" id="photos_era">
<option>Choose your era</option>
<option value="The sixties">The sixties</option>
<option value="The seventies">The seventies</option>
<option value="The eighties">The eighties</option>
<option value="The nineties">The nineties</option>
<option value="The 2000s">The 2000s</option>
<option value="The 2010s">The 2010s</option>
</select>
</div>
<div class="lineGroup"> <label for="photos_ok" class="sublabel" > photos_ok:</label>
<input id="photos_ok" name="photos_ok" type="text" value="" class="formTextfield_Medium" tabindex="4" title="">
</div>
<span class="buttonFieldGroup" >
<input type="submit" value="Insert" class="formButton unstyled" id="Insert" name="Insert" />
</span>
</fieldset>
</form></div>