Send file field text by email on UPDATE?

antonio
Posts: 77
Joined: 2010-09-28 11:48

Send file field text by email on UPDATE?

Post by antonio » 2012-01-20 12:32

Hi all,
I have a Dynamic/nextensio form created as usual.
The form works ok.
The form contains a file field and the upload works. no problem here.
Then I added a Send mail behaviour to send an advice when the user upload a file.

I'm searching for a way to add the file name in the body of the email when I EDIT a record (when I insert a record all works ok).
I can insert almost all info in the email but I cannot get to insert the file name. In fact, the file field is empty when you edit a record.

I tried this tags:
{POST.filename_fil},
{rsfiles.filemane.fil}
{filemane.fil}

But I always get empty file name.

Is there to get the file name in the body of the email?

TIA

ton y

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: Send file field text by email on UPDATE?

Post by Fred » 2012-01-21 14:24

Ok something is wrong somewhere.

If the file fields is empty on update it is obviously not there so the file name will not be sent.

If you look at the database using phpMyAdmin or Navicat, is the file name in the database?
If it is in the db then the next step would be to double check the query and see if the expected results is returned.
Next would be to make sure the dynamic data is populated into the field.

The correct syntax for the email would be {POST.field_id}

antonio
Posts: 77
Joined: 2010-09-28 11:48

Re: Send file field text by email on UPDATE?

Post by antonio » 2012-01-23 09:28

Fred wrote:If the file fields is empty on update it is obviously not there so the file name will not be sent.
If you look at the database using phpMyAdmin or Navicat, is the file name in the database?
If it is in the db then the next step would be to double check the query and see if the expected results is returned.
Next would be to make sure the dynamic data is populated into the field.
The correct syntax for the email would be {POST.field_id}
Thanks Fred,
The db field is there and filled in.
And after the update it is still there, correctly.
If I change the file, and upload a different file the variable {POST-field_id} is correctly passed to the email.

The variable is empty when I update the record without changing the file field.
Another info: if I drag the file field from the bindings panel to the form, I can see the content regularly.
I altro tried to Bind the file field to the related file field, but nothing changes.
It seems that if the file field is not changed, no variable is passed.

Thanks, anyway, Fred. ;)

tony

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: Send file field text by email on UPDATE?

Post by Fred » 2012-01-23 11:35

You know what... I was talking rubbish.

That field should be empty as it is a file upload field and only populated by clicking the brows button. If you do try to put something in the field the page will try to upload the file.

Just a thought here maybe it will get you on the right track.

Create a variable and assign the value in the db to it.
$current_filename

Then use {GLOBALS.current_filename} to add it to the email.
You will need to first check if a new file is being uploaded.
The easiest way to do that would be to have two email SB's the one having a condition and send on update if {POST.file_name} != ' '

Post Reply