Jump to content

Problems with file handling


marcus
 Share

Recommended Posts

Hi,

sorry to bother you again -- I'll try not to open topics/asking questions daily ;) The following codes does not work properly and I'm wondering why:

	<?php $download1 = $pages->get(1014)->download1;?>
	<a href="<?= $download1->url?>">
		<img src="<?php echo $config->urls->templates?>images/pdf.png" />
	</a>	

Ressource 1014 has the field "download1" filled with a dummy pdf, and the URL is printed. But nothing more, ->file, ->filename, ->name, ->ext and so on are empty although the file (dummy_1.pdf) can "physically" be found in /site/assets/files/1014/

Have I missunderstood the Cheat sheet/API in some way?

Thanks again! :)

marcus

Edit: this code is placed in another template, therefore the $pages->get(1014) instead of $page->download1

Link to comment
Share on other sites

*facepalm*

I stepped in the ->first()-trap again... From now on I'll place a post it on my monitor, stating "...have you tried ->first?" or "Try ->first() first before annoying people in the PW forums!" :)

Thanks!

  • Like 1
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

×
×
  • Create New...