close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

upload multiple images with captions with single file field along with one text field for the captions

Thread began 7/05/2021 2:14 pm by JBWebWorks | Last modified 7/06/2021 3:32 pm by JBWebWorks | 276 views | 3 replies

JBWebWorks

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>

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...