Solution for quesiton #1 (in case others are looking for the same).
<?php
$path = $this->get("upload15.file1.path","path not found");
$filename = $this->get("upload15.file1.filename","filename not found");
$name = $this->get("upload15.file1.name","name not found");
$size = $this->get("upload15.file1.size",0);
$this->data("path",$path,true);
$this->data("filename",$filename,true);
$this->data("name",$name,true);
$this->data("size",$size,true);
?>
Can someone please help with how to get a link for the uploaded documents? It appears CF v6 does not have it (perhaps i missed it).
Hi 4Summit,
You can get the info you need in the email or in the database using the shortcodes, just use {var:upload15.file1.name}
To get a link to the file just use http://domain.com/path/{var:upload15.file1.filename}
Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Max,
New to this version! I cannot figure out how to use the shortcode you mention above to save the filename to the database for a form I am building. How is that code implemented to save the filename to a field in the table?
Rick
I figured it out. I need to use the shortcode in my Save Data action, in the "Data override on insert" section, tied to the fieldname.
Sorry!
Rick
Hi Max,
i want to link to a uploaded file as well and tried the shortcode but it doesn't work in my case. (CF6)
For your understanding:
User is filling the form and uploads a file.
SUBMIT EVENT
Everything is saved in db.
User gets an email with verification link to verify his email.
VERIFY EVENT
After verification i'm getting an email and it shows all informations of the last modified data record (verified=1)
It shows as well the filename of the uploaded file -> [file21] => mydocument.pdf
The name of the file on my server gets a timestamp like: 20180712072529_mydocument.pdf
I want to link in my email to my uploaded file like: https:/www.mydomain.de/path/20180712072529_mydocument.pdf
Do you know how i can realize it?
Thanks,
Denny
Hi Max,
i want to link to a uploaded file as well and tried the shortcode but it doesn't work in my case. (CF6)
For your understanding:
User is filling the form and uploads a file.
SUBMIT EVENT
Everything is saved in db.User gets an email with verification link to verify his email.
VERIFY EVENT
After verification i'm getting an email and it shows all informations of the last modified data record (verified=1).
It shows as well the filename of the uploaded file -> [file21] => mydocument.pdf
The name of the file on my server gets a timestamp like: 20180712072529_mydocument.pdf
I want to link in my email to my uploaded file like: https:/www.mydomain.de/path/20180712072529_mydocument.pdf
Do you know how i can realize it?
Thanks,
Denny
Thanks, healyhatman
You know how my verification is working because you helped me a lot to realize it.
I just want to create the link with filename that im able to download the file. The folder where i save the files is blocked for external.
Thanks,
i'm not sure if i did understand everything correctly.
My verification link in my submit event looks like: ".......&event=verify&vid={var:verification_id}"
-> works
After submitting the link, update db from vid=0 (not verified) to vid=1 (verified) + send mail to me to get all informations like name etc.
-> works
Now i have created a new event "download"
Actions: read data (how should the 'where conditions' look like?)
-> FOUND -> download action -> {path:root}path/{var:read_data36.data36.filename}
I put the link in my verify email:
".......&event=download&vid={var:verification_id}"
The read data where clause should look exactly like the one in your verify event
I changed, thanks, i think there is something wrong with the link.
It only looks like this:
"..................&event=download&vid="
Well you will need to generate a new key obviously and save THAT key to the database after verification
Why should i have to generate a new one? I have saved the key and changed the vid from 0 to 1.
Can't i just check if this condition is given?
For the reasons I said before. There needs to be a verification step and code for two reasons : so you know which record to select, and so users can't just download whatever files they want.
Why not just attach the file to the email?
Attaching the file works in my submit email.
But how can i attach the file in my email action in my verify event after the user had verified his email?
the same way? I don't understand. If you're in the verify event you have the row that should contain your file path so you should be able to attach that file
When i use my email action in my submit event and use "Auto Attach file fields" it works perfectly and the uploaded file is attached to the mail.
In my verify event i update my db (setting vid from 0 to 1), check it with a read data and then i send an email to me.
In this mail i need the uploaded file. But there is no file attached when i use "Auto Attach file fields".
Should i write something in "Attachments list", if so, what should i have to do?
Of course Auto attach won't work you haven't uploaded anything within the event.
You said you saved the filename to the database. That's what you need to put in the file field to attach.
Can you tell me what to put in the attachments list?
Tried the full path: {path:root}/path/{var:read_data36.file21.filename} but this causes only that the mail is not send.
You didn't literally just put that did you? You replaced that middle "/path/" with the correct path to your file right? And have you ACTUALLY got the filename by using the {var:read_data} you've put there?
USE A DEBUG ACTION
Of course i replaced "/path/".
What do you mean by ""And have you ACTUALLY got the filename by using the {var:read_data} you've put there?.
I can see in my email with {var.pr:read_data36} the filename in [file21] => documentname.pdf
Debugger: [result] => the Mail could not be sent.
So does the filename that gets returned to you actually exist in the right place on the server?
No, because there is a timestamp before the original filename. Thats what i asked at the beginning of my question how to get this filename with the timestamp.
Example: 20180713062638_documentname.pdf
You've saved the wrong thing to the database, you need the filename from the upload action var not the filename from {data:upload_field}
Can you give me an example? I don't know what to do.
Are you sure your read data action's MODEL name is "file21" ?
No, thats why i'm asking what to do.
The action name is read_data33, the model name Data33
and in file21 should be the filename.
So how should the line look like?
Works for me .
What does the REST of the debug action say? Like very importantly the part of the email action that says "files" ? Does it have the right path and filename there?
Did you copy paste that last shortcode from the forums? If you did, select all and delete it and type it out manually.
Typed it out manually -> same result.
the read data action is in the same event right? If you paste that whole line in a custom code action, is the text of the correct path to the file?
Yes the read data and email actions are in my verify event.
I'm just getting the path without the filename:
/srv/www/www.mydomain.de/www/folder1/folder2/
Can you please paste the WHOLE debug here instead of snippets?
Ok so what you've done is you've got your read data set to retrieve all matching records. Change it to first matching.