I need to replace an old form that was used to send links to end users so they can download files from my server. The name of that program sme_filemailer.
Basically one of my employees would go to this form, select a file name from a drop down menu, enter the persons name and there email address. Once they hit the submit button that would then send the customer an email containing a link to download a file from my server.
I used this because we did not want the employees to just send any file they wanted and we wanted all the emails to come from one email address. So that our customers would not get the email address for our employees.
Hi Mike,
That's very simple, just create a new form, setup your email with the file link, and use the "dynamic to" feature to send it to the email address in the form field.
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
I guess what I am having trouble with is, Is there a way to auto populate the drop down? Or will I have to manually add each file. Can I have more than one drop-down to choose a file from?
Here is an image of the current form
Is there a more in-depth walk thought somewhere?
Hi mike80925,
A more detailed walk-through of which part exactly? Every form is a bit different, I've built one (out of hundreds) that is like yours so there may be details on parts but not the whole.
Bob
I am still pretty new to most of this so as much help as possible would be great. I can make a form just fine it the rest I was looking for a bit more instruction on.
Hi mike80925,
Ok so step 1 is: Where are the file names and how are you going to manage them?
Bob
The files are going to be PDF's and zip files. They are going to be stored on the same server not sure of the folder name yet just that it will be outside of my web folders.
Hi mike80925,
That's the file storage part, I was more interested in managing the file names and titles.
Bob
Sorry for the delay
Here are some examples for the file names
Firmware drop down
Product A firmware XX.XX.XX.zip
Product b firmware XX.XX.XX.zip
Product c firmware XXX.XX.XXX.zip
Drivers drop down
Product a driver.zip
Product b driver.zip
Manuals Dropdown
Product A manual.pdf
Product c manual.pdf
Other
Product A User manual.iso
Product B instructionsto.pdf
Basiclly they will look something like that. There are over 20 or thirty files currently in that folder.
HI Mike,
That's a step forward. Next - how, in Joomla! do you want to link up the file names and titles so that you can access them to build the drop-downs you want?
Bob
Not sure I understand the question
Here is an example for the manuals dropdown, just add the following to the "options" box:
product_a_manual.pdf
product_b_manual.pdf
product_c_manual.pdf
And name that dropdown "manual", then use the following code in your email template:
you can download the manual here:
<a href="http://domain.com/manuals/{manual}">{manual}</a>
I have assumed that all your manuals files are under this path:
http://domain.com/manuals/
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Hi Mike,
Max's answer is one way of adding the file names to a drop-down (though his solution doesn't send an email).
If you are happy to manage the options manually that is fine. My understanding was that you wanted to pick up the names and titles automatically from some place or other. I just have no idea what place.
Bob
I have not decided exactly were I will store the files yet. You are correct I do want the file names to populate on there own.
I still haven't figured this out any ideas.
How do you want to retrieve the files names then ? by scanning a folder or a directory on your web server ?
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Yes, I want to fill dropdown from a folder on my web server.
Hi Mike,
Ok, please add a "custom code" action before the "html" action and insert this code:
<?php
$files = \GCore\Libs\Folder::getFiles("path to folder here");
foreach($files as $k => $file){
$form->data["files"][$k]["name"] = $file;
}
Then, under the "dynamic data" tab in your dropdown, do this:
#1- enable it.
#2- under the path, enter "files".
#3- under both text and id, just enter "name".
That should do what you want, but remember to change the folder path!
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
I get the following error when I try the form [attachment=0]Capture3.PNG[/attachment]
The "Data Path" should be set to "files"
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
How do I stop it from showing the entire file path?
Hi Mike,
You can hide the full path by changing this line:
$form->data["files"][$k]["name"] = $file;
To:
$form->data["files"][$k]["name"] = basename($file);
I'm not sure about the 2nd issue, but isn't it expected to have different paths for the different groups of files ?
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Thanks for the display path fix. It worked great. But Yes, I do want to have different folders for each drop down. but like I said when I add the folder name after the \File_mailer_admin folder i still get the same errors on the page except for the drivers drop-down. Is there something else I can try or share so you can possibly see what I am doing wrong?
What's the error you get ?
You don't have to change the key/text strings as well:
$form->data["files2"][$k]["name2"] = $drivers;
should be
$form->data["files"][$k]["name"] = $drivers;
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
even if I have more than one drop down i don't need to change those?
No, you only need to change the "Data path", in the code and under the drop down settings, but everything else should be fine as its!
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
I am still getting the follow error only on my first drop down.
Warning: array_combine() expects parameter 1 to be array, null given in C:\Program Files (x86)\Ampps\www\joomla30\administrator\components\com_chronoforms5\chronoforms\actions\html\html.php(125) : eval()'d code on line 4
I believe I fixed it. It appears that when i changed the destination folder name to something other than "firmware" it worked. Because I changed the folder name to upgrades and than my form was able to pull the names of files from that folder and when I changed it back it I got the same error as above. I can live with the new folder name now that is working. Now I need to be able to have someone click submit and have the form email a link to download this file.
Maybe your folder was empty ?
Just use {field_name} in the email to display the path selected!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
No the folder is not empty