close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

working with dynamic multiple uploads

Thread began 1/26/2010 7:14 am by sam398359 | Last modified 1/27/2010 1:21 pm by sam398359 | 1373 views | 3 replies

sam398359

solved

After many hours of fiddling and testing, rebuilding the form, testing again. It works!!

Set up your form, be sure to include the name and id of the form. I didn't see this highlighted anywhere but it doesn't work without it.

Apply the DA Repeater to the input fields including the file field. But not the submit button.

I used a INT from a getRecordset to set the amount of repeats. In this example it was the user's number of children.

I then used the DA Insert Multiples behaviour (all this is well document in the dataassist/ recipes)

Test to make sure all is working (the file name will be blank at the moment)

Next apply a DFP upload (from the insert menu) to the page and select the repeating elements you require. Including the file field, but make sure for the Value for the File you press the lightening bolt and find the WA_UPLOAD variables and use Server Filename, this will be sure to insert the filename as it was used and potentially changed by DFP.

(note, once you start changing things here the behaviours will disappear from your interface, meaning that you can't use the DA wizards and forms to make changes)

Find the code that uploads the file.

<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
if($_SERVER["REQUEST_METHOD"] == "POST"){
WA_DFP_UploadFiles("WA_UploadResult1", "fileField_".$RepeatSelectionCounter_1 ."", "2", "[NewFileName]_[Increment]", "false", $WA_UploadResult1_Params);
}
?>

cut and paste the IF part into a new file leaving

<?php
WA_DFP_SetupUploadStatusStruct("WA_UploadResult1");
?>

Next find:
// WA DataAssist Multiple Inserts

and in the WHILE - IF curly brackets paste the contents of the previous IF you pulled earlier:

(I have put a blank between WA code and my new pasted line as I can't see any formatting options for this post)

if ($WA_insertIfNotBlank == "" || WA_AB_checkLoopedFieldsNotBlank(array($WA_insertIfNotBlank), $WA_multipleInsertCounter)) {

WA_DFP_UploadFiles("WA_UploadResult1", "fileField_".$WA_multipleInsertCounter ."", "2", "[NewFileName]_[Increment]", "false", $WA_UploadResult1_Params);

$WA_fieldValuesStr = "".$WA_DFP_UploadStatus["WA_UploadResult1"]["serverFileName"] . "|" . "".WA_AB_getLoopedFieldValue("kidName", $WA_multipleInsertCounter) ."" . "|" . "".WA_AB_getLoopedFieldValue("kidDate", $WA_multipleInsertCounter) ."";
$WA_fieldValues = explode("|", $WA_fieldValuesStr);

You will see I have replaced $RepeatSelectionCounter_1 with the repeating number for the multiple inserts loop $WA_multipleInsertCounter


And that pretty much should be it.

Good luck, is very handy if you have a table of images and and want to assign many images to an entry in another table e.g. users and users photos.

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...