Welcome, Guest
Username: Password: Remember me

TOPIC: How to make files form 1:n collection downloadable

How to make files form 1:n collection downloadable 18 Mar 2016 22:37 #13856

  • krasy
  • krasy's Avatar
  • Offline
  • Premium Member
  • Posts: 90
  • Thank you received: 8
  • Karma: 5
hi,
I have some attachments connected to 1 record,
I can display their filenames in the collection and in also in the fly,

Is there a simple way to convert that names to downloadable links
any ides where to start?

thx
The administrator has disabled public write access.

How to make files form 1:n collection downloadable 21 Mar 2016 12:37 #13859

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 310
  • Thank you received: 131
  • Karma: 48
You can create links
foreach ($item->attachments as $attachment) {
 echo '<a href="'.$attachment->filename.'">'.$attachment->name.'</a>';
}

Filename should be a full url like: www.yourdomain.com/downloads/file1.pdf
The administrator has disabled public write access.
The following user(s) said Thank You: krasy

How to make files form 1:n collection downloadable 22 Mar 2016 19:40 #13860

  • krasy
  • krasy's Avatar
  • Offline
  • Premium Member
  • Posts: 90
  • Thank you received: 8
  • Karma: 5
thx Romkabouter for replay

in collection:
echo JDom::_('html.fly.file', array(
'dataKey' => 'zalacznik',
'dataObject' => $rel,
'height' => 'auto',
'indirect' => true,
'root' => '[DIR_DOKUMENTY_ZALACZNIK]',
'target' => 'download'
));
The administrator has disabled public write access.

How to make files form 1:n collection downloadable 22 Mar 2016 20:20 #13861

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 310
  • Thank you received: 131
  • Karma: 48
I do not understand, did you fix your question with this code or is this generated?
The administrator has disabled public write access.

How to make files form 1:n collection downloadable 24 Mar 2016 10:15 #13867

  • krasy
  • krasy's Avatar
  • Offline
  • Premium Member
  • Posts: 90
  • Thank you received: 8
  • Karma: 5
Hi I have changed generated code of view in collection,
that was connected to 1:n files

to that I've posted and enabled downloading attachment.
It works, all attachment listed is 1:n collection are downloadable :).
thx
The administrator has disabled public write access.

How to make files form 1:n collection downloadable 24 Mar 2016 10:18 #13868

  • Romkabouter
  • Romkabouter's Avatar
  • Offline
  • Elite Member
  • Posts: 310
  • Thank you received: 131
  • Karma: 48
B)
The administrator has disabled public write access.
Time to create page: 0.077 seconds

Get Started