ProcessWire - Uploads: Unterschied zwischen den Versionen
Aus Wikizone
| Zeile 1: | Zeile 1: | ||
== Backend Uploads == | == Backend Uploads == | ||
=== PDF Dateien zum Download anbieten === | === PDF Dateien zum Download anbieten === | ||
| − | Im Backend auf Array stellen und auf pdf einschränken. | + | Im Backend auf Array stellen und auf pdf einschränken. Für das Icon nehmen wir font-awesome. |
| + | |||
| + | '''Template''' | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
// Backend Field Name is file_upload | // Backend Field Name is file_upload | ||
Version vom 23. Mai 2017, 11:40 Uhr
Backend Uploads
PDF Dateien zum Download anbieten
Im Backend auf Array stellen und auf pdf einschränken. Für das Icon nehmen wir font-awesome.
Template
// Backend Field Name is file_upload
$fileUploadMarkup = '';
$nFiles = count($page->file_upload);
if($nFiles){
foreach ($page->file_upload as $file) {
$fileUrl = $file->httpUrl;
$fileName = ($file->description) ? $file->description : $file->name;
$fileSize = $file->filesizeStr;
$fileUploadMarkup .= "
<div class='file'>
<i style='color: #a91e1e;' class='fa fa-file-pdf-o' aria-hidden='true'></i> <a href='$fileUrl' target='_blank'>$fileName</a> ($fileSize)
</div>";
}
}$fileUploadMarkup = "<div class='fileUploads' style='margin-bottom:4px;'>$fileUploadMarkup</div>";
Frontend Uploads
https://processwire.com/talk/topic/206-renaming-uploaded-files-from-tmp_name/#entry1371%C2%A0