Jump to content

Getting file properties, can only get url


Up2l8
 Share

Recommended Posts

Im trying to get the filename property from a file field. The file i added is a wav file. I get the url by using -> url but that is the only propery i get. I have tried with description and name and filename

I have the same problem with images... i can only get url.

Part of my code

 $animalpages =  $pages->find("template=Animal");
        foreach( $animalpages as $animal ) {
          echo($animal->AnimalSound->filename);   Does not write anything
          echo($animal->AnimalSound->url); Gives me the url
}
 
 
 
Link to comment
Share on other sites

It gives me 

/pw/site/assets/files/1020/

This would be the urls to the folder not the image itself, it's because you were outputing the $page->field->url and not the image because it was an array. 

  • Like 1
Link to comment
Share on other sites

Strange, when I changed the field to single item i now gives me the path to the file. But it add a lot off stuff.

Image field single item
$animal->Animalmage->url gives me /pw/site/assets/files/1020/cat.jpg
 
File field singe item
$animal->AnimalSound->url gives me /customers/7/9/6/itsystems.se/httpd.www/pw/site/assets/files/1020/cat.wav
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...