Skip to content

Original filenames for Pages upload fields (Invision Community 4)

This code snipped for the custom display settings of a Pages upload fields create a list of files showing the original file name. Useful for offering multiple PDF downloads for example. 

{{if $formValue}}
	<ul>
	{{foreach $value as $manual}}
		{{$file = \IPS\File::get('cms_Records', (string) $manual);}}
		<li>
			<a href="{$file->url}">{$file->originalFilename}</a>
		</li>
	{{endforeach}}
	</ul>
{{endif}}

Originally posted by newbie LAC

Additional hint: non-standard file extensions cannot directly be accessed in the upload directory security reasons. If you want to access them or offer them for download, you need to link to them this way:

…/applications/core/interface/file/cfield.php?storage=downloads_FileField&path=[file_path]

 

Important Information

We are using functional cookies

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.