Jump to content

[Field] File Upload Problem


drilonb
 Share

Recommended Posts

I am trying to make a field for Uploading file like PDF DOC and other

but the problem is when i try to use it in template is linking  just to the file path "/file/assets/1/" not to the direct link where the file is

i am using like this code

<?php echo $page->fileuploadss->url; 

and how to display her description in template.

Thanks is PROCESS WIRE 2.1

Link to comment
Share on other sites

It sounds like you've got a multi-file field rather than a single file field. You can fix this by either changing it to a single file field (by setting it to contain a max of 1 files in the field settings). OR you can change your code to this:

<?php 
echo $page->fileuploadss->first()->url; 

how to display her description in template.

Here's how you might display her description, assuming you are sticking with the multi-file field.

<?php
$her = $page->fileuploadss->first(); 
echo "<img src='{$her->url}' alt='{$her->description}' />";
echo "<p>{$her->description}</p>";
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...