Forums

How subdivide multifile uploads into linked filenames?

gmarra7 03 Apr, 2019
Hi, I need to separate the names of the files loaded with the multifield method,
because I made sure that they are linkable and therefore downloadable.[file=11888]link_multifield.jpg[/file]
healyhatman 03 Apr, 2019
If you copy+paste your debug here, specifically the file upload parts, you'll be able to see exactly what you're after.
gmarra7 04 Apr, 2019
I have a view link. In content I inserted {var: read_sinistro.Sinistro.file33} and
in URL and / or URL parameters: https://scuole.unimega.it/components/com_chronoforms6/chronoforms/uploads/{var:read_sinistro.Sinistro.file33}.

I am trying to explode or split a Multi-file-select comma separated
string from CF6 into CC6 table with the download links and their
belonging link paths. I attach screenshot

Max_admin 04 Apr, 2019
{data:file33} they are separated in the data array!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
healyhatman 04 Apr, 2019
Don't save {data:file33} to the database or use it like Max said, that's the original filename and not the filename as uploaded on your server.

First I would turn off Auto Manage Database, and go and change "file33" column on your database to "files"
Then in data override on insert, put
files:{var.jsonen:upload15.[n].filename}
To separate them into links (and do you REALLY want anyone at all to be able to download any file in your folder?) you can use a loop (not loop event) set to var only with data source
{var:upload15.[n].filename}
to build your links text.
gmarra7 05 Apr, 2019
Sorry when you write "Then in data override on insert, put" where you mean to insert this shortcode.
In "Details List", in "Link" etc.?
I understand these operations that I have to do them in chronoforms and not in chronoconnectivity?
Because now I'm in this situation. Thanks

healyhatman 05 Apr, 2019

Sorry when you write "Then in data override on insert, put"


In the save data action on the form submitting the files. Because if you look at your debug at the upload15 action, you'll see that the files are given different names when you upload them. You need to save THOSE filenames to your database, using the code I gave you.
gmarra7 05 Apr, 2019
This code files:{var.jsonen:upload15.[n].filename}
has been replaced as "I click on" "Data override" it only returns "table field name" etc.

I don't see any field to save this code. Thanks.

healyhatman 05 Apr, 2019
table field name: file33 (unless you're going to do what you're told and rename the file33 field in your database to files and turn off auto manage database
value: {var.jsonen:upload15.[n].filename}
gmarra7 05 Apr, 2019
file33 I turned it into a file as you indicated.
Now this code {var.jsonen: upload15. [N] .filename} where should it be entered?
healyhatman 05 Apr, 2019
Where I told you. Add a data override to your save data action. Table field name will be "files" and the value will be {var.jsonen:upload15.[n].filename}
gmarra7 05 Apr, 2019
You mean this right? But should auto manage data table leave it on?
healyhatman 05 Apr, 2019
NO turn it off. It will add in all the fields from your design tab to your database structure.
And did you call your database field FILE or FILES ?
gmarra7 05 Apr, 2019
Ok. Now I try. Yes I have corrected file in files. Thank you.
healyhatman 05 Apr, 2019
Great. Now when you display it in CCv6 you have to decide how to do it.

Do you want to directly link to the file because you haven't thought about security and you don't care if anyone at all downloads all the files? Then just loop through {var.jsonde:ccv6tableviewname.row.model.files} and make a link like <a href="/components/com_chronoforms6/chronoforms/uploads/{var:loop.row}">My file</a>

Do you want to create a download event that your link points to because you thought about security and you've locked the folder down so random people can't download whatever they want from it? Then loop through {var.jsonde:ccv6tableviewname.row.model.files} and make links pointing to a download event with the ID of the tableview entry and the index of the file (from your loop's .key parameter) and then have the download event read the database entry again using the ID, get the right filename from files using the passed file index, and use that in a download action.
gmarra7 05 Apr, 2019
In the form I did this:


Now in chronoconnectivity I gave this setting

Action link:


Details List:


But it doesn't work, the result is this:
gmarra7 06 Apr, 2019
Excuse me but when you write "Then just loop" does it mean that in chronoconnectivity I have to use a loop action or just use a link action?
I'm trying to do what you suggested but it doesn't seem to work. Thank you healyhatman!
healyhatman 06 Apr, 2019
Well you have multiple links per entry right? To display the links you'll need a loop
gmarra7 06 Apr, 2019
Good evening healyhatman, as I understand it I have to use a loop to iterate the array relative
to multiple files and we do it through json decode.

I set this way, but to no avail, now I don't know I can't use the shortcodes for good:

Loop:

Link download documents:



Details List:


Frontend-view:

When I try to download the files it returns me: https://scuole.unimega.it/components/com_chronoforms6/chronoforms/uploads/?event=view

I can't get into the file array and link them

Thanks
healyhatman 06 Apr, 2019
You have a loop, but you've misspelled the data source, you haven't put the download view in the loop, and you haven't told the details view to use the loop.
gmarra7 06 Apr, 2019
I'll think about what you told me and I'll work on it tomorrow. One last suggestion but in the "Loop" action in "Loop body" I have to insert some other "shortcodes". Thanks
gmarra7 07 Apr, 2019
The loop I set it this way is fine, now in the link action what should I enter?
healyhatman 07 Apr, 2019
Again depends on how you're doing it. But either way it should be the link text you want. Use {var:loop.row} in the loop body to get the current filename
gmarra7 07 Apr, 2019
What I would like to do is make sure that those two files that are now contained here
[files] => ["Lezione_IX.pdf", "Lezione_VIII.pdf"],
I could visualize them in separate mod to create separate links, example:
File1 download: Lezione_IX.pdf
File2 download: Lesson_VIII.pdf

Now following your valuable advice I have reached this point, but it seems not enough to make it work:

Loop:

Link:

Details List:


Something is missing. Thanks
healyhatman 07 Apr, 2019
*sigh* yes something is missing. You need to use the loop to create a series of links. The last code you were given in my last post has the filename each loop, turn it into a link.
gmarra7 07 Apr, 2019
Sorry, you mean that? (sinistro_dettagli is my detail list)
healyhatman 07 Apr, 2019
Sure looks good have you tried it? I'll leave you to it it's 1am
gmarra7 07 Apr, 2019
Thank you, good night.
If the only one who tries to give answers in the face of an apparently very powerful component but from a completely inadequate documentation.
Really a pity.
At some point you want to create many custom_codes and then you want to stop using chronoconnectivity
healyhatman 07 Apr, 2019
What you're trying to do is actually very easy but you just lack the understanding of basic concepts
gmarra7 08 Apr, 2019
Precisely for this reason I am trying to understand with your precious contribution how to make chronoconnectivity work.
Then I got to this point,

- I created this loop which should access via json_decode () shortcodes: {var.jsonde:sinistro_dettagli.row.Sinistro.files} to the point of the array [files] => ["details_list.png", "link.png"]
- Cycle returning to me separate links thanks to the including shortcodes in the body loop: <a href="/edocman/allegati_denunce/{var:loop.row}"> My file </a>

Now to call up the loop in the view




But it is as if this loop function did not return any result. What am I doing wrong?

Thanks.
healyhatman 08 Apr, 2019
The view needs to be called in the details view column setup. I could have this done in seconds if you paid me. $75AUD p/hr , 30 minute blocks minimum
healyhatman 08 Apr, 2019
OK This is the last time I'm going to help for free on this issue because I've spent hours. Here we go, start to finish, pay attention.

1) Create an Event called download
2) Create a download function called download_file
---- a) File directory path: {path:root}/pathtoyourfolder/{data:file} (replace pathtoyourfile to whatever you need to to give a path to your upload folder)
3) Create a Link element called download_link
---- a) Event: download
---- b) Content: {var:file}
---- c) URL and/or URL parameters: file={var:file}
4) Create a Loop function called files_links_loop
---- a) Data provider: {var.jsonde:details_view_name.row.model.files} (if this bit doesn't work, try removing the model)
---- b) Loop body: {view:download_link$file=(var:files_links_loop.row)}<br>
5) In your details view, under fields views, put model.files:{fn:files_links_loop}

Do all that and it will work. If it doesn't work, you've done it wrong.
gmarra7 09 Apr, 2019
Everything worked perfectly. You have been precise and detailed.

I really appreciated what you did and I think that other forum users have appreciated it.

This enhances the time you invest and today those who want to donate to healyhatman will have an extra reason to do so.

I believe that if there was a little more documentation this component could become as widespread and appreciated as Chronoforms.

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

VPS & Email Hosting 20% discount
hostinger