close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

working with dynamic multiple uploads

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

sam398359

working with dynamic multiple (repeated) uploads

Ok, will start from the beginning.

I have Security Assist set up, one of the questions it asks is how many children you have, this is stored.

I then have an update page where users can update their details, this works.

On the same page I have another form that loops another form based on how many children they have. For each loop the user can fill in the name, birthdays and a photo. This is stored in another table using the UserID from the Security Assist registration.

This works (eventually, WA does screw up more than my liking and gives no errors)

But i only got it working for a test stage. When i try to apply the DFP behaviour on the file field, no data is added into the database and no images are uploaded.

Does it not work this way? But even if the file upload didn't work, why does it then not insert any data?

Looking at the code it seems the file upload is only set to run once, and not loop.

Is this possible?

Next experiment will be to loop the upload function after the form is submitted.

Thanks

Sign in to reply to this post

Dani Chankhour

If you have multiple file fields then you will need to have separate Digital File Pro Upload Server Behavior, you can try looping the Upload function, but you will need to make sure that the fileField are generated dynamically as well.

Sign in to reply to this post

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.

Sign in to reply to this post

Dani Chankhour

Thanks a lot for your response, I'm sure this will be helpful for users.

Sign in to reply to this post

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