Multi Upload - Need help to set it up

LAMF 12 Dec, 2012
Hi!
I posted this maybe in the wrong place so I move it here instead:

I have just installed the new Chronoforms withthe new feature Multi Upload.
The problem is that i can't get the file attached to the sent email.

I have attached a backup copy of my form here so you can see my settings.

Briefly I have set the Field name in the Preview like this: attachments[]

Then under Ebents I set it up like this:
Fields configuration: attachments[]:jpg-png-gif-pdf
Maximum limit: 5
Max size: 300

No more settings.
This is obviously not done by the book as it doesn't work so maybe someone brighter can enlighten my day....

Thanks.
Micke
LAMF 13 Dec, 2012
Hi,
I have came so far with this now that I have got everything working except to attach the files to the email sent by the form.
The attachment gets uploaded to the defined path on the web server but not attached to the email.
Can anyone please help me with this final step?
GreyHead 30 Dec, 2012
Hi LAMF,

I've worked out how add files from the Multi-upload widget to a zip file and attach that to an email. Please see this FAQ.

Bob
LAMF 10 Jan, 2013
Hi guys,
I gave this up and now when coming back I saw your two replies so I gave it a try again.
I went for Bobs suggestion without having to hack the code.
Still no success.
Here's my setup:
In the Wizard under Preview => Multi Upload => General tab:
Label text: Bilagor (attachments in english)
Field Name: bilaga[]
Lmimit: 5

In the Wizard under Events => On Submit => Upload Files => Settings tab:
Enabled: Yes
Fields Configuration: bilaga[]:jpg-png-gif-pdf-zip-rar
Upload Path: JOOMLA_PATH/images/files
Max size in KB: 500
Min Size in KB: 1
Under Advanced tab:
Array Fields: bilaga[]

I then added the custom code under the Events between the Upload Files and the first Email action.
I set it up like this:
Settings tab:
Mode: Controller
Action Label: Zippa bilagor (zip attachments)
Code: Your code from the tutorial

Then finally in the email action where the files should be attached I set it up like this:
Enabled: Yes
Action Label: upload_zip
Send as: html
Attachments fields name: bilaga[],upload_zip

But it still wont attach any files nor zip nor upload to server.
So where did I do wrong?
It would be awesome if this could work out.

Another little thing is the styling.
If I want to change the text link label saying: "Attach file" to Swedish, how do I do that?
Also would like to add the button class to it so it looks like a button.

Thanks!
Micke
LAMF 10 Jan, 2013
I have now managed to upload the zip file to the server and the specified file path.
The changes I made to make this possible was:
Take away the [] after the Field Name: bilaga in the Multi Upload under Preview.

In the Wizard under Events => On Submit => Upload Files => Settings tab:
Fields Configuration: bilaga:jpg-png-gif-pdf-zip-rar

Under Advanced tab I took away the:
Array Fields:

In the custom code I commented out the code for deleting the original file (unfortunately I had to do this):
//JFile::delete($f['path']);

Then in the email event:
Attachments fields name: bilaga,upload_zip

Now it uploads the files to the server but doesn't attach them in the email.
And unfortunately it seems not possible to get rid of the original file.
GreyHead 10 Jan, 2013
Hi LAMF,

Our posts crossed, I wrote this before your last one.

Please try one quick fix before we dig deeper. Each place that you have 'bilaga[]' (except the first one, the Widget Field Name) please just put 'bilaga' I think that ChronoForms will handle the [] where needed for the others.

The Attach file isn't obviously translatable without hacking the code, the Multi-language plug-in doesn't change it. Please try this JavaScript which worked on my test:
window.addEvent('domready', function() {
  $$('a.multi-upload-add-attachment').each(function(el) {
    el.innerHTML = 'Bifoga fil';
  });
});


Please see this FAQ for a way to zip files and attach them to an email if that helps.

Bob
LAMF 10 Jan, 2013
Hi Bob,

I was wrong it is attaching one file to the email and zips it as well. So there are two files attached, one original and one zipped. Bo matter if I attach more than one thereäs only one attached.
How can I solve that so I get multiple fiels added to one zipped?

Also the javascript, where should I paste that in`?
GreyHead 10 Jan, 2013
Hi LAMF,

I have the [] in there in my test form and Max's User note says to add them . . .

The JavaScript should go into a Load JS action in the On Load event.

Bob
LAMF 10 Jan, 2013
Hi Bob,

When adding the [] (see picture) I get an error message and no sent message at all.
Multi Upload - Need help to set it up image 1

The javascript works!
Is it also possible to add the button class to the
<a class="multi-upload-add-attachment command"> 
hyperlink for the "Attach file" link, that you find under the
<div class="multi-upload-add-attachment command lft-button">
?
It should maybe be possible with a template override in joomla if I only find the file with the divs.
GreyHead 10 Jan, 2013
Hi LAMF,

What error message so you get?

Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.

You should be able to add the class like this
window.addEvent('domready', function() {
  $$('a.multi-upload-add-attachment').each(function(el) {
    el.innerHTML = 'Bifoga fil';
    el.addClass('lft-button');
  });
});

Bob
LAMF 10 Jan, 2013
Thanks Bob the class was added smoothly!

the debug message is like this:

Data Array: 
Array
(
    [chronoform] => kontakt-m
    [event] => submit
    [Itemid] => 499
    [option] => com_chronoforms
    [lang] => kontakt
    [view] => form
    [namn] => Micke
    [email] => micke@lmiab.se
    [subject] => Tesar
    [message] => 
jlh


    [multi_upload_limit_bilaga] => 3
    [recaptcha_challenge_field] => 03AHJ_VuuBIy_TNjd8DmP5OPGRNRlOH8J62rlrnijz-_a9FpkLh9NxXzKLDm7ehCAmNPYlGGQwJLDTTWBbuBHIFrTcG3zT2En7c83MTCC0ZrD3Zd6p3oSnpau6CqLhlqKk2tT2noNVG-iVYw1A4-ud2-NSPstkWU1lN-jeGkr4oA8HsC8t5rJeNKQ
    [recaptcha_response_field] => ityuba Butter
    [submit] => Skicka
    [b72d4f0da97956e7a1a98abc5cfa4207] => 1
    [bilaga] => 20130110140915_FiskekortWebb2012ar.pdf
    [_PLUGINS_] => Array
        (
            [upload_files] => Array
                (
                    [bilaga] => Array
                        (
                            [name] => 20130110140915_FiskekortWebb2012ar.pdf
                            [original_name] => FiskekortWebb2012ar.pdf
                            [path] => /storage/content/07/100607/fly-tiers.se/public_html/images/files/20130110140915_FiskekortWebb2012ar.pdf
                            [size] => 65807
                            [link] => http://www.fly-tiers.se/images/files/20130110140915_FiskekortWebb2012ar.pdf
                        )

                )

        )

)


In this code it says only one file was uploaded while i tried to attach 4 different files. (limit is 5).
LAMF 10 Jan, 2013
Hi Bob,
Solved!

My fault. I had totally missed to use the Multi File upload action instead of the standard Upload file action under the events. 😶

But nevertheless it was a good lesson and you definitely don't need the hack of the email.php file.
You should not uncomment the:
//JFile::delete($f['path']); -line
If you uncomment this line it wont work. At least not for me but that's no big deal.
LAMF 18 Jan, 2013
I reopen this as it sin't completely solved.
The thing tha tremain to be solved is that it is not possible to uncomment the line of code in the script that erases the original files on the server.
If I uncomment it the form doesn't work.
It would be great if it was possible to erase the original files somehow.

regards,
LAMF
GreyHead 19 Jan, 2013
Hi LAMF,

I checked the Joomla! docs and the JFile::delete() code looks correct.

What exactly happens when you uncomment it?

If you set Site Error Reporting to Maximum do you see a useful error message?

Bob
This topic is locked and no more replies can be posted.